Node.js compatibility

Understanding Node.js compatibility in the Workers runtime.

Node.js is a popular JavaScript runtime for building server-side apps, offering access to system resources and core modules like fs, path, and http. Many npm packages depend on these modules or other Node.js-specific APIs.

Edge environments, such as Webflow Cloud, run code closer to users for better speed, scalability, and security. Instead of full Node.js support, Webflow Cloud relies on Web APIs such as fetch, Request, and Response. While Workers runtime compatibility with Node.js APIs is improving, key differences and limitations remain.

Understanding these differences is essential for building apps on Webflow Cloud.

Node.js compatibility in Webflow Cloud

The Workers runtime is steadily expanding support for Node.js APIs, but there are still limitations.

  • Native support: Many Node.js APIs are now natively supported, including modules like Buffer, crypto, stream, and path. See the Cloudflare Node.js compatibility matrix for the full list.
  • Polyfills: For unsupported APIs, Cloudflare provides polyfills. These partial implementations enable many packages to run, but unsupported methods may throw errors at runtime.

When you deploy to Webflow Cloud, Node.js compatibility settings are automatically applied to your Worker.

wrangler.jsonc
1{
2 "compatibility_date": "2025-04-15",
3 "compatibility_flags": [
4 "nodejs_compat"
5 ]
6}

You can’t edit or override these settings when deploying to Webflow Cloud.

  • Node.js compatibility and polyfills are enabled by default.
  • You cannot add, remove, or customize polyfills or compatibility flags.
  • Some npm packages that require unsupported Node.js APIs or extra configuration may not work as expected. If you encounter issues, use native Web APIs instead.

Common errors

If you use an unsupported Node.js API, you may see errors in your build logs:

  • Module not found or import errors
    Build log
    $Could not resolve 'fs'
    >Unexpected external import of 'fs', 'http'
    >Could not access built-in Nodejs modules
  • Runtime exceptions
    Build log
    $Worker threw a JavaScript exception (Cloudflare error code 1101)
    >Uncaught Error: No such module 'buffer' imported from 'index.js'
  • Silent failure or incomplete functionality
    Build log
    $Uncaught Error: No such module 'buffer' imported from 'index.js'

If you encounter these errors, switch to native Web APIs or supported APIs. For more details, see the Cloudflare Node.js compatibility matrix and the official Cloudflare Workers Node.js API docs.

Best practices for edge compatibility

Use Web APIs for network and data operations

Node.js APIs aren’t always supported in the edge runtime. When that’s the case, use the equivalent Web API — see below for a list of common Node.js APIs and their Web counterparts.

✅ Use (Web APIs)❌ Avoid (Node.js APIs)Notes / alternatives
fetch, Request, Responsehttp, https, netUse fetch for all HTTP requests.
crypto.subtlecryptoUse SubtleCrypto for hashing/encryption.
FormData, URL, URLSearchParamsquerystring, form-dataUse Web APIs for URL and form data.
Uint8Array, TextEncoder, TextDecoderBufferPrefer Web APIs for binary/text data.
External storagefs, path, osNo file system access; use external storage.
Edge-native concurrency (stateless)child_process, worker_threadsNo process spawning or threads.
StreamsstreamUse the Web Streams API.
setTimeout, setIntervalN/ASupported, but limited by worker/request lifetime.

Choose edge-compatible libraries

Many popular libraries now rely on Web APIs instead of Node.js core modules. When possible, choose libraries built for edge environments or with pure JavaScript implementations.

To help, we’ve compiled a list of popular libraries and their edge-compatible alternatives.

Use caseNode.js libraryEdge-compatible alternativesNotes
Password hashingbcryptbcryptjs, bcrypt-edgebcrypt-edge is optimized for Cloudflare Workers and other edge environments.
Image manipulationsharppica, jimp, ImageScriptNo native Node.js; use WASM or pure JS alternatives.
File uploadsmulterBrowser FormData + direct upload to R2/S3Use browser-native FormData and direct upload to object storage (R2/S3). For server-side, avoid Node.js streams.
Database ORMPrisma@prisma/client (with Prisma Edge), drizzle-ormPrisma Edge requires compatible drivers and edge support.
AuthenticationNextAuth.jsClerk, Auth0, Auth.jsUse providers with edge support. Auth.js is working toward full edge compatibility.
EmailnodemailerResend, SendGrid, Cloudflare EmailUse a service that supports edge environments.
JWT authjsonwebtokenjoseLightweight, edge-compatible JWT library.
ID generationuuid, shortidnanoidFast, secure, and edge-compatible.

Troubleshoot library compatibility

  • Check for errors like ReferenceError: process is not defined or Module not found: fs. These indicate Node.js dependencies that aren’t supported in the Workers runtime.
  • Polyfills using unenv or custom wrangler.jsonc aren’t currently supported on Webflow Cloud.

Resources