Skip to content

Cannot use Svix JS SDK in ESM mode #1554

Closed
@danilofuchs

Description

@danilofuchs

Bug Report

Version

1.43.0

Platform

Linux, Node 22.11.0 LTS

Description

After upgrading to Svix 1.43.0, I cannot import Webhook from svix:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/danilo/salvy/salvy-api/node_modules/.pnpm/[email protected][email protected]/node_modules/svix/dist/esm/openapi/index' imported from /home/danilo/salvy/salvy-api/node_modules/.pnpm/[email protected][email protected]/node_modules/svix/dist/esm/index.js
import { Webhook } from "svix";
         ^^^^^^^
SyntaxError: Named export 'Webhook' not found. The requested module 'svix' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'svix';
const { Webhook } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:177:[21](https://github.com/SalvyLTD/salvy-api/actions/runs/12238907040/job/34138088620#step:10:22))
    at async ModuleJob.run (node:internal/modules/esm/module_job:260:5)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26)
    at async Promise.all (index 82)
    at async file:///home/runner/work/salvy-api/salvy-api/docs/src/generate-openapi.ts:11:29

My package.json contains type: "module"

Metadata

Metadata

Assignees

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