Next.js · build warning
The "middleware" file convention is deprecated
⚠ The "middleware" file convention is deprecated. Please use "proxy" instead.
To migrate automatically, run:
npx @next/codemod@canary middleware-to-proxy .What it means
Next.js 16 renamed middleware.ts to proxy.ts. Agents keep creating middleware.ts because most examples predate the rename. Proxy runs on the Node.js runtime, and the runtime option isn't allowed in proxy files.
Common causes
- An agent added auth or redirects in middleware.ts
- Code copied from Next.js 13–15 or Auth.js v4 examples
How to fix it
- Run npx @next/codemod@canary middleware-to-proxy . or rename the file and the exported function to proxy
- Remove any export const runtime = "edge" from it
- Keep matchers in export const config as before
import { NextResponse, type NextRequest } from "next/server";
export function proxy(request: NextRequest) {
return NextResponse.next();
}
export const config = { matcher: ["/dashboard/:path*"] };Prompt for Cursor or Claude Code
This is Next.js 16: middleware.ts is deprecated in favor of proxy.ts. Migrate it (rename the file and the exported function to proxy, keep the matcher config, remove any runtime export) and check nothing else imports the old file.Not quite your error? Paste yours into the free VibeBoot Doctor or browse the Next.js error fixer.
next: skip the next one
Skip the debugging. The VibeBoot SaaS Starter ships with this already handled: it follows the Next.js 16 conventions (src/proxy.ts, Server Components by default, request-time data in <Suspense>) and its AGENTS.md and .cursor/rules keep your agent on them. Plus auth, Stripe and a database on Next.js 16.4.3. $49, one-time.
14-day money-back guarantee · lifetime updates
Other Next.js errors
- useState / useEffect in a Server Component
- Event handlers cannot be passed to Client Component props
- Functions cannot be passed directly to Client Components
- Only plain objects can be passed to Client Components
- "use client" must be placed before other expressions
- export "metadata" from a "use client" page
$ fixed it? get the next one first
New fixes for what AI agents break, by email.
When we add a fix or a Cursor rule for a new Next.js, Auth.js, Prisma or Stripe break, it goes out in the VibeBoot newsletter. Free, occasional, unsubscribe in one click.