Trouble deploying Auth.js with Sveltekit on Cloudflare Pages - `node:crypto`

Hi all! I've been having a fun time trying to debug a build issue for the past few days using Auth.js on a Cloudflare Pages project built using SvelteKit.
The problem seems to stem from the use of node built-in modules, but even after enabling
nodejs_compat
, I'm facing errors related to the use of node:crypto.
Could anyone shine some light on where to go about debugging this issue?

$ npx wrangler pages dev --d1=DB .sveltekit/cloudflare

[...]

✘ [ERROR] service core:user:dms-hgm: Uncaught SyntaxError: The requested module 'node:crypto' does not provide an export named 'constants'

    at null.<anonymous>
  (file:///workspaces/dms/.svelte-kit/output/server/chunks/hooks.server.js:7:257)


✘ [ERROR] MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.

(When deployed to pages directly, the error is the same, minus the stack trace.)

3258fd10.dms-hgm.pages.dev
Acc. ID: 84e974647453d280b13cd8438d22d3c3
Was this page helpful?