Cloudflare Workers / Pages: Node built-ins fail until you enable nodejs_compat
@devsingh05▲ 10 net votes
Workers run on a V8 isolate, not Node, so imports like node:crypto, node:buffer, or libraries that use them fail at build or runtime. Add compatibility_flags = ['nodejs_compat'] and a recent compatibility_date in wrangler.toml (or the Pages project settings). Even then, raw TCP sockets, the filesystem and native addons are unavailable, so most traditional database drivers need an HTTP-based alternative.