Skip to content

@databricks/sql@2.0.0 fails in CommonJS/Jest environments due to ESM uuid loaded via thrift #461

Description

@arunthomas32

Summary

After upgrading @databricks/sql from 1.17.x to 2.0.0, our Jest-based test suite started failing during module load.

The failure happens when @databricks/sql is required from a CommonJS environment. The import chain reaches thrift/node_modules/uuid/dist-node/index.js, which is ESM, and Jest then throws a syntax error.

This did not happen with @databricks/sql@1.17.x.

Error

.../node_modules/thrift/node_modules/uuid/dist-node/index.js:1
export { default as MAX } from './max.js';
^^^^^^

SyntaxError: Unexpected token 'export'

Relevant stack excerpt:

at Object. (node_modules/@databricks/sql/lib/index.ts:4:1)
at Object.require (mocks/@databricks/sql.js:7:25)

Expected behavior

@databricks/sql should be loadable in CommonJS/Jest environments without requiring consumers to add custom ESM transforms for transitive dependencies.

Actual behavior

Loading @databricks/sql@2.0.0 causes Jest to parse an ESM file from a transitive dependency (uuid under thrift) and fail before tests execute.

Notes

This appears to be related to packaging/module compatibility in the dependency chain:

@databricks/sql -> thrift -> uuid/dist-node/index.js (ESM)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions