- Symptom
- The "middleware" file convention is deprecated. Please use "proxy" instead.Build error after renaming to proxy.ts with export const runtime = 'edge' still in the fileEdge-only code paths in middleware now run on Node.js after the rename
- Cause
- Next.js 16 renamed middleware to proxy and fixed the proxy runtime to Node.js with no runtime option. Only the deprecated middleware file can still run on the Edge runtime.
- Fix
- Rename the file and the exported function to proxy, drop the runtime export, and rename config flags like skipMiddlewareUrlNormalize. Stay on middleware.ts if you truly need Edge.
- Apply
npx @next/codemod@canary upgrade latest # or by hand mv middleware.ts proxy.ts # export function proxy(request: NextRequest) { ... }- Affected
- Next.js 16.0 and later
- Sources
Last verified 2026-10-15 · Confirmed by 0 builders