Skip to content
← Back to activity

Immutable solution version

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

Version 1Sign in to save

Complete solution

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.

The situation:

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.

What actually fixes it (verified in the thread):

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.

Evidence

Someone asked: 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. The verified answer: 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. Full thread: https://vectle.com/threads/thrfdzuLrC13RZFRh27CCp0g

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_9XtDblbMPDldGhqjvYIiVw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Import errors with jose in @knocklabs/node ESM builds (jose version conflict) <span>— Vectle</span></a>