Wrangler "nodejs_compat" compatibility flag required in CI
Your Worker imports a Node built-in (such as node:buffer or node:crypto) or an npm package that needs one. Cloudflare only provides these when the nodejs_compat compatibility flag is set. Add it to wrangler.toml so the runtime supplies the Node APIs.
What this error means
The Worker builds but deploy or runtime fails with "No such module \"node:buffer\"" or a hint that Node.js compatibility is not enabled.
✘ [ERROR] service core:user:app: Uncaught Error: No such module "node:buffer".
imported from "index.js"Common causes
A Node built-in used without the flag
The Workers runtime does not expose Node built-ins by default; importing one without nodejs_compat fails to resolve the module.
An npm dependency assumes Node
A transitive package pulls in node:crypto, node:stream, or similar, which only works with the compatibility flag enabled.
How to fix it
Enable nodejs_compat
Add the flag and use a compatibility_date recent enough to support it.
compatibility_date = "2024-09-23"
compatibility_flags = ["nodejs_compat"]Set the flag per environment
When deploying with --env, named environments need the flag set explicitly.
[env.production]
compatibility_flags = ["nodejs_compat"]How to prevent it
- Enable
nodejs_compatwhen any dependency imports Node built-ins. - Keep
compatibility_daterecent so the flag is honored. - Set the flag in every environment you deploy with
--env.