Open miketamis opened 4 months ago
~~Is the crypto API you need listed here? https://developers.cloudflare.com/workers/runtime-apis/nodejs/crypto/~~
As an alternative, consider using web crypto instead: https://developers.cloudflare.com/workers/runtime-apis/web-crypto/
I had a similar issue and solved it that way.
edit: node:crypto
is officially unsupported by Nextjs
As @Maronato mentioned I think this just boils down to Next.js not supporting node:crypto
:
https://github.com/vercel/next.js/blob/6b6575ce48c6378be4dc9e89d83fc11fa29e7010/packages/next/src/build/webpack/plugins/middleware-plugin.ts#L801-L807
So even though Cloudflare does (partially) support node:crypto
I think that there isn't really much we can do about it until Next.js also supports that (in the edge runtime that is).
next-on-pages environment related information
System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:43 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6000 CPU: (10) arm64 Apple M1 Pro Memory: 16 GB Shell: /bin/zsh Package Manager Used: npm (9.6.7)
Relevant Packages: @cloudflare/next-on-pages: 1.9.0 vercel: N/A next: N/A
Description
Module build failed: UnhandledSchemeError: Reading from "node:crypto" is not handled by plugins (Unhandled scheme).
Reproduction
import crypto from 'node:crypto';
within a route.
Pages Deployment Method
None
Pages Deployment ID
No response
Additional Information
No response
Would you like to help?