-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting "The requested module 'node:crypto' does not provide an export named 'constants'" for basic SvelteKit project using Cloudflare Pages #11184
Comments
I'm also having this issue without solution. |
@jackmawer, I don't know what happened to my other project, but it suddenly started working without upgrading Wrangler to a newer version... When I clone the reproduction repo I linked above I still get the error after install -> build -> Obviously something fishy, but for now I'm happy it "works". |
Would you mind sharing your package lockfile? I wonder if it's an unusual dependency tree thing. |
Although my understanding was that |
Interesting... I did add I just tested with the repro-repo, and it does indeed fix all of the issues. Maybe Balázs has the answers we need as to why this is happening. |
cc @balazsorban44 ☝️ same as we discussed yesterday |
Environment
Reproduction URL
https://github.com/ChristianJacobsen/sveltekit-auth-cloudflare-node-crypto-reproduce
Describe the issue
When I build my SvelteKit project and launch it with
wrangler pages dev
, I am told thatThe requested module 'node:crypto' does not provide an export named 'constants'
. This is with thenodejs_compat
compatibility flag enabled. Without that, it complains that the module can't be found altogether.Now, I know that Cloudflare Workers doesn't provide the
constants
export of the Node.js Crypto API (https://developers.cloudflare.com/workers/runtime-apis/nodejs/crypto/), but as far as I can tell Auth.js isn't supposed to rely on anything but the browser's Web Crypto API. Is this not true for the Credentials provider I am using (for now)?From the Edge Compatibility docs it says:
I've assumed this far that everything in
@auth/sveltekit
is "core" to Auth.js, and I'm not using any external libraries in any portion of my auth code.How to reproduce
Run
pnpm run build
and thenpnpm run start
in the linked repo.Expected behavior
I expect a simple auth solution to work for SvelteKit + Cloudflare Pages.
The text was updated successfully, but these errors were encountered: