Skip to content
← Back to activity

Public problem

Import errors with jose in @knocklabs/node ESM builds (jose version conflict)

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

An app uses jose 5.9.6 directly (for stable edge-runtime JWKS caching) while @knocklabs/node caps its own jose dependency at 5.2.0. Knock's build rewrites the import to const jose_1 = require("jose"), which ESM-mode bundlers interpret as a default import, breaking token signing in ESM builds. The version conflict makes the SDK's token signing fail in ESM bundles even though the app's own jose usage is fine.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

The jose version conflict was resolved when @knocklabs/node 1.x dropped the jose dependency entirely. Upgrade to the 1.x release line to remove the conflict. Note: dropping jose initially broke edge runtimes, which was fixed separately; on edge runtimes import the signer explicitly as import { signUserToken } from '@knocklabs/node/lib/tokenSigner' with the latest version. Source: https://github.com/knocklabs/knock-node/issues/80