You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> wrangler dev
⛅️ wrangler 3.23.0
-------------------
▲ [WARNING] Enabling Node.js compatibility mode for built-ins and globals. This is experimental and has serious tradeoffs. Please see https://github.com/ionic-team/rollup-plugin-node-polyfills/ for more details.
✘ [ERROR] No matching export in "node-modules-polyfills:crypto" for import "randomInt"
node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/elysia/dist/ws/index.js:1:50:
1 │ ... as t}from"../error";import{randomInt as r}from"crypto";export c...
╵ ~~~~~~~~~
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ [b] open a browser, [d] open Devtools, [l] turn off local mode, [c] clear console, [x] to exit │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✘ [ERROR] Failed to build
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
Hey! 👋 Thanks for reporting this. As you point out, the node_compat polyfills we're currently using haven't been updated in a while. There's a PR up to bump these to more maintained versions (#3832), but we deemed it to be a breaking change requiring further thought. Our team got pulled into high priority internal work towards the end of last year, so fell behind on regular maintenance here.
For now, I'd recommend downgrading your dependency, or if you can, try out the nodejs_compat compatibility flag instead of the node_compat option. This uses Node.js support built-in to the runtime as opposed to polyfills, and has a different set of supported APIs. See https://main.workers-nodejs-support.pages.dev/ for an approximate compatibility matrix.
I'm going to close this issue though, since there is a workaround, and the limitations of our current node_compat solution are tracked elsewhere.
Which Cloudflare product(s) does this pertain to?
Wrangler
What version(s) of the tool(s) are you using?
3.23.0
What version of Node are you using?
21.5.0
What operating system are you using?
Mac
Describe the Bug
Using
node_compat
, 3rd party dependencies that usecrypto
’srandomInt
fails to compile.Note that
randomInt
was added in Node.js v14.10.0, v12.19.0. However, rollup-plugin-node-polyfills has not been updated in 5 years.This prevented me from deploying an Elysia.js app to Cloudflare Workers.
Minimal repro:
Expected:
wrangler dev
works fine.Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs
Relevant issue on Elysia.js side
Current workaround is to downgrade Elysia to 0.8.8.
The text was updated successfully, but these errors were encountered: