v2 moved to using web crypto but there is still import(‘node:crypto’) somewhere which doesn’t allow running in Convex’s default cf-workers like v8 isolate runtime and i need to use the slower ‘use node’ runtime. I just want to use the lightweight RoomServiceClient, from what I understand LiveKit wants to make it edge compatible in non-node runtimes like workers and others natively.
I believe the fix might be very simple: As node:crypto is only being used as backup if web crypto isn’t available, so making it so that bundler doesn’t conflict.
From agent:
On using livekit-server-sdk@2.17.0 on Convex’s default action runtime (V8 isolate, CF Workers–like: has fetch + Web Crypto, no Node builtins).
The SDK is clearly meant to be isomorphic (Web Crypto first, jose, edge/browser tests in the package). At runtime that works: globalThis.crypto.subtle is present, so digest / uuid would take the Web Crypto branch.
But at bundle time Convex fails with something like:
Could not resolve “node:crypto”
…because these still ship a Node fallback:
packages/livekit-server-sdk/src/crypto/digest.ts→await import('node:crypto')packages/livekit-server-sdk/src/crypto/uuid.ts→ same
Isolate bundlers (Convex default runtime, and often Workers without Node compat) resolve that dynamic import even when it’s in an else branch that never runs.
Consider one of:
- A pure-web / edge export condition that omits the
node:cryptofallback entirely, or - Dropping the Node fallback (Node 18+ has global Web Crypto anyway), or
- Making the fallback injectable / compile-time stripped so edge bundlers don’t see
node:crypto
