@auth/sveltekit! I have the same issue

@auth/sveltekit! I have the same issue on cf pages functions.
> Using @sveltejs/adapter-cloudflare
21:38:26.511 ✘ [ERROR] Could not resolve "crypto"
21:38:26.512
21:38:26.512 .svelte-kit/output/server/chunks/hooks.server.js:4:26:
21:38:26.513 4 │ import * as crypto$1 from "crypto";
21:38:26.513 ╵ ~~~~~~~~
21:38:26.513
21:38:26.513 The package "crypto" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
21:38:26.514
21:38:26.516 ✘ [ERROR] Could not resolve "node:buffer"
21:38:26.517
21:38:26.517 .svelte-kit/output/server/chunks/hooks.server.js:6:23:
21:38:26.517 6 │ import { Buffer } from "node:buffer";
21:38:26.517 ╵ ~~~~~~~~~~~~~
21:38:26.517
21:38:26.517 The package "node:buffer" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
21:38:26.517

...

21:38:26.532 error during build:
21:38:26.532 Error: Build failed with 4 errors:
21:38:26.532 .svelte-kit/output/server/chunks/hooks.server.js:4:26: ERROR: Could not resolve "crypto"
21:38:26.532 .svelte-kit/output/server/chunks/hooks.server.js:6:23: ERROR: Could not resolve "node:buffer"
21:38:26.532 .svelte-kit/output/server/chunks/hooks.server.js:7:26: ERROR: Could not resolve "node:crypto"
21:38:26.532 .svelte-kit/output/server/chunks/hooks.server.js:9:22: ERROR: Could not resolve "node:util"
> Using @sveltejs/adapter-cloudflare
21:38:26.511 ✘ [ERROR] Could not resolve "crypto"
21:38:26.512
21:38:26.512 .svelte-kit/output/server/chunks/hooks.server.js:4:26:
21:38:26.513 4 │ import * as crypto$1 from "crypto";
21:38:26.513 ╵ ~~~~~~~~
21:38:26.513
21:38:26.513 The package "crypto" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
21:38:26.514
21:38:26.516 ✘ [ERROR] Could not resolve "node:buffer"
21:38:26.517
21:38:26.517 .svelte-kit/output/server/chunks/hooks.server.js:6:23:
21:38:26.517 6 │ import { Buffer } from "node:buffer";
21:38:26.517 ╵ ~~~~~~~~~~~~~
21:38:26.517
21:38:26.517 The package "node:buffer" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
21:38:26.517

...

21:38:26.532 error during build:
21:38:26.532 Error: Build failed with 4 errors:
21:38:26.532 .svelte-kit/output/server/chunks/hooks.server.js:4:26: ERROR: Could not resolve "crypto"
21:38:26.532 .svelte-kit/output/server/chunks/hooks.server.js:6:23: ERROR: Could not resolve "node:buffer"
21:38:26.532 .svelte-kit/output/server/chunks/hooks.server.js:7:26: ERROR: Could not resolve "node:crypto"
21:38:26.532 .svelte-kit/output/server/chunks/hooks.server.js:9:22: ERROR: Could not resolve "node:util"
3 Replies
Robin
RobinOP12mo ago
I added the nodejs_compat flag in the functions settings both envs, but builds still fail The issue comes from authjs, which uses those node libraries. I really want to stay with cloudflare over vercel
Kithe
Kithe12mo ago
GitHub
Support Node Compat in Cloudflare Adaptor · Issue #10028 · sveltejs...
Describe the problem Cloudflare announced Connect to PostgreSQL and it can provide database access from Cloudflare Workers, which combined with SvelteKit would be very powerful: https://developers....
Kithe
Kithe12mo ago
Looks like the new version of cf adaptor is now supported node compat https://github.com/sveltejs/kit/pull/11672
GitHub
feat: support compatible node modules without prefixes by Rich-Harr...
This is a companion to #10544. Cloudflare workers let you import from node:path, but not from path. This is annoying to fix if you're not the one writing the import (i.e. it's in a dependen...
Want results from more Discord servers?
Add your server