Next.js · sdk · fg-0306
Next.js 16 warns middleware is deprecated, and proxy.ts throws if you set runtime = 'edge'
The "middleware" file convention is deprecated. Please use "proxy" instead.
Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100
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) { ... }Affects: Next.js 16.0 and later
Sources
- https://nextjs.org/docs/app/guides/upgrading/version-16
- https://nextjs.org/docs/app/api-reference/file-conventions/proxy
Have your agent know this before it fails
claude mcp add --transport http footgun https://getfootgun.com/api/mcp