Skip to content
Blue Nebula

Next.js

Next.js 16 vs 15: breaking changes and how to fix them

The seven Next.js 16 changes most likely to break a Next.js 15 app, with the code to fix each one before you upgrade.

By Luna R.Published Updated 10 min read

In practice, Next.js 16 vs 15 comes down to a short list of changes that can break an existing app: params, cookies() and the other request APIs are async-only, Turbopack builds by default, next lint and runtime config are gone, next/image is stricter, and middleware is now called proxy. Codemods handle most of the mechanical work[2].

I lead front-end engineering on Grubby AI, a Next.js app, and this site runs on Next.js 16.3 with React 19. I upgraded it myself, and I’ve noted below where these changes hit it.

What changed in Next.js 16

Turbopack is now the default bundler for next dev and next build, which shortens builds and hot updates. Routing and prefetching were rebuilt to transfer less data per navigation. Cache Components, which you turn on yourself, make caching explicit: nothing is cached unless you mark it with "use cache". And middleware has a new name, proxy[1].

Next.js 15 vs 16 at a glance

Summarized from the release post and the upgrade guide[1][2].

AreaNext.js 15Next.js 16
BundlerTurbopack stable for dev; optional for buildsTurbopack is the default for dev and build; top-level turbopack config
CachingImplicit App Router caching; PPR experimentsOpt-in Cache Components with "use cache"; PPR flags removed
Routing and prefetchStandard prefetchingLayout deduplication and incremental prefetching cut transfer size
React CompilerExperimental supportStable support; opt in with reactCompiler
Middlewaremiddleware.tsproxy.ts replaces it and runs on Node.js; config flags renamed
Lintingnext lint availablenext lint removed; use the ESLint CLI or Biome
ImagesAny quality value; 60-second minimum cache TTLStricter defaults and security checks; priority deprecated for preload

What’s faster in Next.js 16

According to the release post, Turbopack gives 2–5× faster production builds and up to 10× faster Fast Refresh[1]. Navigation is leaner too: a layout shared by several links is prefetched once, and Next.js only prefetches what isn’t already cached[1]. Expect more prefetch requests in the network tab, with a much smaller total transfer[2].

Cache Components are off by default and replace the old PPR flags. Turn them on with cacheComponents: true in next.config.ts, then mark what to cache with "use cache"[1]. At the top of a file, it caches every export:

TSX
// app/page.tsx
"use cache";

export default async function Page() {
  // Any async data here is cached by key the compiler derives.
  // You can still tag or invalidate as needed.
  return <main>Welcome to Next.js 16</main>;
}

If you tried Partial Prerendering on a Next.js 15 canary, note that experimental.ppr and the route-level experimental_ppr export are gone. PPR now comes through Cache Components and works differently, so the upgrade guide says to stay on your 15 canary until you’ve migrated[2].

Seven changes to fix before you upgrade

These are the changes most likely to break a Next.js 15 app. The proxy rename (number 2) is formally a deprecation, since middleware.ts still runs in 16; it’s here because the upgrade codemod can apply it, and proxy doesn’t support the Edge runtime.

1) Request APIs and route params are async-only

Next.js 15 made cookies, headers, draftMode, params and searchParams async but still allowed synchronous access, with warnings[3]. Next.js 16 removes that fallback, so every one of them has to be awaited, including params in pages, layouts, route handlers and default.js files[2].

The image functions in opengraph-image, twitter-image, icon and apple-icon now get params and id as Promises too, as does sitemap for the id from generateSitemaps. generateImageMetadata still gets plain params[2].

Update the signatures and await the values:

TSX
// Before (15 - sync access tolerated)
export default function Page({ params, searchParams }) {
  const slug = params.slug;
  const q = searchParams.q;
  return (
    <h1>
      {slug}: {q}
    </h1>
  );
}

// After (16 - async access required)
// PageProps is a global type generated by next dev, next build or
// next typegen (15.5+), so there's nothing to import.
export default async function Page(props: PageProps<"/blog/[slug]">) {
  const { slug } = await props.params;
  const query = await props.searchParams;
  return (
    <h1>
      {slug}: {query.q}
    </h1>
  );
}
JavaScript
// app/shop/[slug]/opengraph-image.js
// generateImageMetadata still receives plain params
export async function generateImageMetadata({ params }) {
  const { slug } = params;
  return [{ id: "1" }];
}

// The image function gets params and id as Promises
export default async function Image({ params, id }) {
  const { slug } = await params;
  const imageId = await id;
  // ...
}

The upgrade codemod skips the async request API migration, so run it separately[2]:

Shell
npx @next/codemod@canary upgrade latest
# not part of "upgrade"; run it if you still read these APIs synchronously:
npx @next/codemod@canary next-async-request-api .
# and, if needed for types:
npx next typegen

2) middleware.ts is deprecated and renamed to proxy.ts

Rename middleware.ts to proxy.ts and its exported function to proxy, and update config flags with “middleware” in the name (skipMiddlewareUrlNormalize is now skipProxyUrlNormalize). The upgrade codemod handles all of it[2].

Proxy always runs on Node.js, and its runtime can’t be configured. If your middleware needs the Edge runtime, keep middleware.ts for now; it still works in 16 but will be removed in a future version[1][2].

TypeScript
// proxy.ts (Next.js 16)
import { NextRequest, NextResponse } from "next/server";

export default function proxy(request: NextRequest) {
  if (request.nextUrl.pathname === "/") {
    return NextResponse.redirect(new URL("/home", request.url));
  }
  return NextResponse.next();
}

On this site, I removed middleware.ts instead of renaming it. If yours only sets headers or static redirects, headers() and redirects() in next.config can do that job.

3) Turbopack is the default, and its config moved

Turbopack now runs for both next dev and next build, so the --turbopack flag can go, and Turbopack’s options move from experimental.turbopack to a top-level turbopack key. With a custom webpack config, next build fails on purpose so the config isn’t silently ignored. You can build with --webpack for now, but the recommendation is to migrate[2].

JSON
// package.json
{
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  }
}
TypeScript
// next.config.ts
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  turbopack: {
    // your options here
  },
};

export default nextConfig;

If the build complains about a webpack config you never wrote, a plugin is probably adding one[2]. Plugins can cause other config failures too. On this site, the installed @next/mdx (still a 15.x release) injected a turbopack.conditions option that failed Next 16’s config validation, so I removed it and compile MDX on the server with @mdx-js/mdx instead. Check that every plugin in next.config is on a version released for 16.

4) Local images with query strings need a localPatterns entry

Local images with a query string in src, like /assets/photo?v=1, are now blocked unless images.localPatterns allows them, to prevent enumeration attacks[2]. Give search the exact query string, leading ? included; leaving it out allows any query string, which undoes the protection.

TypeScript
// next.config.ts
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  images: {
    localPatterns: [
      {
        pathname: "/assets/**",
        search: "?v=1",
      },
    ],
  },
};

export default nextConfig;

5) next/image has new defaults

Several image defaults changed[2]. The easiest to miss: images.qualities now defaults to [75], and other quality values are coerced to the closest allowed one, so quality={90} renders at 75 until you add 90 to the list. minimumCacheTTL went from 60 seconds to 4 hours, imageSizes lost 16, images from local IPs are blocked, and the optimizer follows at most 3 redirects[2].

Two APIs are deprecated, too. priority gives way to preload, a switch I made on this site. And images.domains, deprecated since Next.js 14, should move to images.remotePatterns, which can also restrict protocol and path[2]:

TypeScript
// next.config.ts
const nextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: "https",
        hostname: "images.example.com",
        pathname: "/cdn/**",
      },
    ],
  },
};

export default nextConfig;

6) next lint is removed

The next lint command is gone, and next build no longer lints, so a CI pipeline that relied on the build stops linting without any error[2]. Run ESLint (or Biome) directly:

JSON
// package.json
{
  "scripts": {
    "lint": "eslint .",
    "build": "next build"
  }
}

The upgrade codemod handles this, or run npx @next/codemod@canary next-lint-to-eslint-cli . on its own[2]. The eslint option in next.config is gone too, and @next/eslint-plugin-next now defaults to ESLint’s flat config[2].

7) serverRuntimeConfig and publicRuntimeConfig are removed

Runtime configuration through next/config is gone; use environment variables. To read one at request time, call connection() first in a Server Component or Route Handler[2]. Skip the NEXT_PUBLIC_ prefix for these: NEXT_PUBLIC_ values are inlined at build time, even in server code, so connection() can’t make them dynamic.

TSX
// app/page.tsx
import { connection } from "next/server";

export default async function Page() {
  await connection(); // ensure runtime read
  // No NEXT_PUBLIC_ prefix: those values are inlined at build time.
  const apiUrl = process.env.API_URL;
  return <p>API: {apiUrl}</p>;
}

Summary of the seven changes

ChangeImpactYour fix
Async-only request APIs and paramsSync access removedawait them; run the codemod
middleware.ts → proxy.tsDeprecated; proxy is Node.js onlyRename, or keep middleware for Edge
Turbopack default and config moveBuild fails with a webpack configTop-level turbopack; --webpack for now
Local images with query stringsImages fail to loadAdd images.localPatterns with search
next/image defaultsOther quality values become 75Set images.qualities; use preload
next lint removedCI stops lintingRun ESLint or Biome directly
Runtime config removednext/config breaksEnv vars; connection() for request-time reads

The upgrade guide lists more than these seven[2]. Two to check: parallel route slots now need a default.js file or the build fails, and AMP support is gone.

Prerequisites and the order I’d upgrade in

Next.js 16 needs Node.js 20.9 or later and TypeScript 5.1 or later; Node 18 is no longer supported[2]. If your app depends on custom Webpack loaders, plan time to map them to Turbopack, or build with --webpack while you migrate[2].

Then I’d go in this order:

  1. Upgrade Node and TypeScript, then run the upgrade codemod. It moves the Turbopack config, switches next lint to the ESLint CLI, renames middleware to proxy and drops unstable_ prefixes[2].
  2. Run the async request API codemod and fix what it flags for review, then check images for query strings, quality values, priority props and images.domains.
  3. Test proxy.ts with logging on, or keep middleware.ts if it needs the Edge runtime.
  4. Make sure CI runs ESLint or Biome itself.
  5. Replace next/config with environment variables, adding connection() where a value must be read at request time.

Getting the speed gains after you upgrade

Turbopack’s filesystem cache keeps compiled output on disk between runs. It was an opt-in beta in 16.0[1] and is now on by default for next dev and next build[2]. For builds, it only helps if your CI keeps .next/cache between runs.

The React Compiler is stable but off by default. It memoizes components for you, cutting unnecessary re-renders, but it runs through Babel, so compiles get slower[1]. Try it on a branch and compare.

Routing improvements need no code changes[2]. cacheLife and cacheTag are now stable, so drop the unstable_ prefixes[2]. Use updateTag() in a Server Action when the person who made a change must see it right away (read-your-writes), and revalidateTag(tag, "max") for content that can be briefly stale: visitors get the cached version while fresh data loads in the background[2]. The one-argument revalidateTag(tag) is deprecated and now a TypeScript error[2].

TypeScript
// app/actions.ts (Server Actions)
"use server";

import { updateTag, revalidateTag } from "next/cache";

export async function updateUserProfile(userId: string, profile: any) {
  // write
  // await db.users.update(userId, profile);

  // immediate read-your-writes for this user
  updateTag(`user-${userId}`);
}

// revalidateTag also has to run inside a Server Action or Route Handler.
// Here it keeps long-lived content fresh with stale-while-revalidate:
export async function publishPost(postId: string) {
  // await db.posts.publish(postId);
  revalidateTag("blog-posts", "max");
}

Measure before and after you upgrade

The measurable payoff is speed: faster builds and Fast Refresh from Turbopack, and lighter navigation between pages[1]. Explicit caching is harder to put a number on, but it makes what’s cached visible in the code.

Before you start, record a baseline: time a production build and check how much a typical navigation downloads. Then upgrade on a branch, run the codemods there and compare. Next.js 16 no longer prints per-route size and First Load JS in the next build output, so use Lighthouse or your analytics for page weight on both sides[2].

Most of a 15-to-16 upgrade is mechanical: the codemods and the type checker walk you through the async APIs and the renames. Spend the time that saves on next.config and anything that writes to it, since that’s where my own upgrade failed. And if any <Image> sets a quality, add that value to images.qualities before you ship.

Sources

01

Next.js Team. (2025, Oct 21). Next.js 16. Retrieved from https://nextjs.org/blog/next-16

02

Next.js Documentation. (2025). Upgrading: Version 16. Retrieved from https://nextjs.org/docs/app/guides/upgrading/version-16

03

Next.js Team. (2024, Oct 21). Next.js 15. Context on Async Request APIs and caching changes. Retrieved from https://nextjs.org/blog/next-15

Written by

Luna R.

Founder and engineer at Blue Nebula, a one-person studio in Daly City, CA, that builds web apps, Shopify stores and AI features. Top Rated Plus on Upwork with 3,700+ hours of client work.

More about me

Building on Next.js?

Tell me what you’re building.

mail@bluenebula.dev
Start a project