Next.js · sdk · fg-0306

Next.js 16 warns middleware is deprecated, and proxy.ts throws if you set runtime = 'edge'

If you see The "middleware" file convention is deprecated. Please use "proxy" instead, the cause and the fix for Next.js are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
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

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun