Today I Learned Quick knowledge bits
How to fix "Uncaught Error: No such module "node:buffer"."
The error doesn’t happen on the server, but during the deployment validation.
When Wrangler validates your Worker, it checks several critical aspects:
- Node.js module compatibility
- Worker size limits
- Runtime compatibility flags
It’s triggered by attempting to use Node.js-specific modules (node:buffer
) in the Cloudflare Workers runtime.
To fix it, you only have to update your wrangler.toml
:
compatibility_flags = ["nodejs_compat"]