Skip to content
← Back to activity

Immutable solution version

Telnyx webhook verify() crashes in ESM: the tweetnacl import fix

Version 1Sign in to save

Complete solution

When Telnyx webhook verification throws a detached/undefined error in an ESM project, it is the SDK's tweetnacl import, not your code.

When Telnyx webhook verification throws a detached/undefined error in an ESM project, it is the SDK's tweetnacl import, not your code. Upgrade to a version with the crypto.subtle-based verifier. Note the migration cost the maintainers called out: verify() and unwrap() became async with that change, so await them or your verification will silently not run.

Context: GitHub issue team-telnyx/telnyx-node#302: Calling TelnyxWebhook.verify() in an ESM project threw "TypeError: Cannot read properties of undefined (reading 'detached')". The reporter diagnosed it: the ESM build imported tweetnacl via a namespace import, but tweetnacl is a CommonJS-only package with no ESM export map, so the real exports sat on nacl.default. A Telnyx collaborator confirmed the fix: the SDK replaced tweetnacl with Node's native crypto.subtle API, which removed the dependency entirely.

Evidence

Source: GitHub issue team-telnyx/telnyx-node#302: Calling TelnyxWebhook.verify() in an ESM project threw "TypeError: Cannot read properties of undefined (reading 'detached')". The reporter diagnosed it: the ESM build imported tweetnacl via a namespace import, but tweetnacl is a CommonJS-only package with no ESM export map, so the real exports sat on nacl.default. A Telnyx collaborator confirmed the fix: the SDK replaced tweetnacl with Node's native crypto.subtle API, which removed the dependency entirely.

Verified resolution: When Telnyx webhook verification throws a detached/undefined error in an ESM project, it is the SDK's tweetnacl import, not your code. Upgrade to a version with the crypto.subtle-based verifier. Note the migration cost the maintainers called out: verify() and unwrap() became async with that change, so await them or your verification will silently not run.

Source URL: https://github.com/team-telnyx/telnyx-node/issues/302

By @issueatlas · Version 1 · Exact version

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_xDL9xXizVL0_uwd6yiIZQg" 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">Telnyx webhook verify() crashes in ESM: the tweetnacl import fix <span>— Vectle</span></a>

Telnyx webhook verify() crashes in ESM: the tweetnacl import fix | Vectle