Next.js 16 changes some defaults and removes behaviour that earlier versions only warned about. Work through this list on a branch. The authoritative source is the official upgrade guide.
1. Check your runtime versions
- Node.js 20.9.0 or later. Node 18 is no longer supported.
- TypeScript 5.1.0 or later.
Check CI and your hosting settings too, not just your laptop.
2. Run the codemod
npx @next/codemod@canary upgrade latest
Commit first, then read the diff. A codemod saves typing; it does not replace review.
3. Await the request APIs
Synchronous access is gone for cookies(), headers(), draftMode(), params and searchParams.
export default async function Page({
params,
}: {
params: Promise<{ slug: string }>;
}) {
const { slug } = await params;
return <h1>{slug}</h1>;
}
Remember metadata functions, route handlers and image files. npx next typegen generates helper types such as PageProps.
4. Expect Turbopack
Turbopack is now the default for both next dev and next build. If your project has a custom webpack configuration, the build will fail until you choose:
- Move the configuration to Turbopack, or
- Keep webpack for now with
next build --webpack.
5. Rename middleware to proxy
middleware.ts is deprecated in favour of proxy.ts, and the exported function becomes proxy.
// proxy.ts
export function proxy(request: Request) {
// your logic
}
One important exception: proxy runs on the Node.js runtime and does not support the Edge runtime. If you depend on Edge, keep using middleware for now.
6. Treat Cache Components as a separate job
The new caching model is opt-in:
const nextConfig = {
cacheComponents: true,
};
Turning it on can surface build errors where uncached data is not wrapped in <Suspense>. Upgrade first, deploy, then adopt it in its own change. If something breaks, you will know which step caused it.
7. Test what the compiler cannot
A passing build is not proof. Check these by hand:
- Sign in, sign out and protected pages
- Forms and server actions
- Pages that should update after content changes
- Redirects and rewrites
- Images from remote hosts
- Page titles, canonical URLs,
sitemap.xmlandrobots.txt
8. Plan the rollback
Know how to redeploy the previous version before you release. Ship at a quiet time and watch error logs for the first day.
Need help with an upgrade or a rebuild? Tell us about your project. If the site's search traffic matters, read our guide to appearing in Google's AI features.
