Next.js: Using Node.js modules in Edge Runtime (Proxy or Middleware)
Next.js says your Proxy or Middleware uses a Node.js module in the Edge Runtime? Edge does not support Node.js APIs. Remove the import or use a Web API.
Reviewed October 25, 2026
What it means in plain English
Next.js's Using Node.js Modules in Edge Runtime page says this error occurs when the code in your Proxy or your Edge API Routes uses a feature from the Node.js runtime. The Edge Runtime does not support Node.js APIs and globals.
Proxy is the new name for the middleware file. Next.js's Proxy page has a version history: Middleware could use the Node.js runtime as an experiment from v15.2.0 and as a stable option from v15.5.0. In v16.0.0, Middleware was deprecated and renamed to Proxy, and Proxy defaults to the Node.js runtime. So this error mostly shows up in Middleware or Edge API Routes that run in the Edge Runtime, when they or anything they import use a Node.js-only module.
Likely causes
- The Proxy or Middleware file imports a Node.js module, such as
crypto, directly. - It imports a helper or package that uses a Node.js module somewhere inside.
- An Edge API Route uses a Node.js API.
How to fix it, step by step
- Run the app locally with
next dev. Next.js says the console and the browser show which file is importing and using the unsupported module. - Follow that file chain back to the Proxy, Middleware, or Edge API Route that imports it.
- Avoid the module there. Next.js's two options are to stop importing it, or to replace it with a polyfill.
- Where a Web API can do the job, use it. Next.js's example is replacing the Node.js
cryptomodule with the Web Crypto API. - If you need Node.js APIs in that file, check the version history on Next.js's Proxy page against your Next.js version. Proxy, from v16.0.0, defaults to the Node.js runtime, and Next.js says the
runtimeconfig option is not available in Proxy files. - Check Next.js's Edge Runtime page for the list of supported and unsupported APIs before adding another import to that file.
- Run
next devagain and confirm the error is gone, then rebuild.
How to check it worked
next devno longer reports a Node.js module in the Edge Runtime.- Requests that pass through the Proxy or Middleware work in production.
Sources
Related fixes
More Next.js errors fixes
Keep going on your own.
The guides stay free. A deep leak report is $15. Fix packs are $24, or $49 for all three. There is no done-for-you repair.