- 10 Oct, 2025 5 commits
-
-
nextjs-bot authored
-
nextjs-bot authored
-
nextjs-bot authored
-
Zack Tanner authored
This ensures we captured `middlewareClientMaxBodySize` in the config schema and rather than triggering a hard error, it will buffer up to the limit.
-
JJ Kasper authored
Corrects the expired/stale checks in the tags manifest and updates test case to capture this.
-
- 09 Oct, 2025 32 commits
-
-
Sam Selikoff authored
-
nextjs-bot authored
-
Jimmy Lai authored
 - update codemod script - upgrade both release scripts, not sure which one is correct <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> --------- Co-authored-by:
graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
nextjs-bot authored
-
Wyatt Johnson authored
### What? Adds build-time validation to require explicit `default.js` files for all parallel route slots (except the implicit "children" slot). This validation is implemented in both Webpack and Turbopack bundlers. ### Why? Parallel routes without `default.js` files currently cause silent 404 errors when users navigate to those routes. This creates confusion and hard-to-debug issues because the routes appear to be configured correctly but fail at runtime without any indication of what went wrong. By making this validation explicit at build time, developers get immediate feedback about missing required files with clear error messages and documentation links, catching configuration mistakes before deployment. ### How? **Rust/Turbopack** (`crates/next-core/src/app_structure.rs`): Added `MissingDefaultParallelRouteIssue` that emits a build error when a parallel route slot is missing its `default.js` file. The validation is skipped for the "children" slot since it's implicit and doesn't require a default file. **Webpack** (`packages/next/src/build/webpack/loaders/next-app-loader/index.ts`): Added validation that throws `MissingDefaultParallelRouteError` when `default.js` cannot be resolved. The "children" slot falls back to the existing `PARALLEL_ROUTE_DEFAULT_PATH` behavior for backward compatibility. **Error Class** (`packages/next/src/shared/lib/errors/missing-default-parallel-route-error.ts`): New error type with helpful messaging that includes the slot path, explanation of the requirement, and a link to documentation. **Migration Path**: Users who want the previous 404 behavior can explicitly create a `default.js` that calls `notFound()`, or return `null` for empty slots: ```tsx import { notFound } from 'next/navigation' export default function Default() { notFound() } ``` Users can also run the following Deno script to generate the default files for them: https://gist.github.com/wyattjoh/ba7263ecb637ef399d3e3e4db63ffbd6 **Breaking Change**: This is a breaking change timed for Next.js 16 beta. Builds will now fail if parallel route slots are missing required `default.js` files. -
JJ Kasper authored
-
Steven authored
[Breaking] feat(next/image)!: add support for `images.dangerouslyAllowLocalIP` and `images.maximumRedirects` (#84676) This PR adds a two new options and sets a strict default value for each. - `images.dangerouslyAllowLocalIP` - `images.maximumRedirects` ### dangerouslyAllowLocalIP In rare cases when self-hosting Next.js on a private network, you may want to allow optimizing images from local IP addresses on the same network. However, this is not recommended for most users so the default is `false`. > [!NOTE] > BREAKING CHANGE: This change is breaking for those who self-hosting Next.js on a private network and want to allow optimizing images from local IP addresses on the same network. In those cases, you can still enable the config. ### maximumRedirects Since are also testing redirects for local IPs, we can also reduce the maximum number of redirects to 3 by default. Unlike normal websites which might redirect for features like auth, its unusual to have more than 3 redirects for an image. In some rare cases, developers may need to increase this value or set to `0` to disable redirects. > [!NOTE] > BREAKING CHANGE: This change is breaking for those who need image optimization to follow more than 3 redirects.
-
Jiwon Choi authored
This PR modifies Image behavior to require `images.localPatterns.search` value when used with search queries in the `src` property: ```jsx // Error <Image src="/api/user?id=1" width="50" height="50" /> ``` ```ts // next.config.ts export default { images: { localPatterns: [ { pathname: '/api/user', // Either set explicit query string or leave undefined to match all search: '?v=2', }, ], }, } ``` It is to prevent malicious actors like Denial of Wallet (DoW) attacks and strictly match the search queries for image optimization. The deprecation warning was added at https://github.com/vercel/next.js/pull/82627 --------- Co-authored-by:Steven <steven@ceriously.com>
-
Zack Tanner authored
This provides a way to refresh the client cache from within a server action. This is useful when you need to refresh the client UI / read your writes without needing to rely on `updateTag`. --------- Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
JJ Kasper authored
Closes: https://github.com/vercel/next.js/pull/84484
-
Karl Horky authored
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> ### What? Make a note about the `$ACTION_` properties in `formData` ### Why? Starting with next@14.1.3, `$ACTION_` properties have appeared in the `formData`, which cause validation errors when used with a strict validation with a library such as Zod or Yup: ```tsx // Form Client Component export default function Form() { const [state, formAction] = useFormState(action, { type: 'initial', }); return ( <form action={action}> {/* ... */} </form> ); } // Server Action export async function action( prevState: ServerActionReturnValue, formData: FormData, ): Promise<ServerActionReturnValue> { const validationResult = await schema.validate( Object.fromEntries(formData.entries()), ); ``` The errors from Yup: Errors: - this field has unspecified keys: $ACTION_REF_1, $ACTION_1:0, $ACTION_1:1, $ACTION_KEY The data in the formData.entries() ```js { '$ACTION_REF_1': '', '$ACTION_1:0': '{"id":"59f475b...","bound":"$@1"}', '$ACTION_1:1': '[{"type":"initial"}]', '$ACTION_KEY': 'k187677481', // Real form data starts here: year: '2024', ``` ### How? 1. Document additional properties with keys starting with the prefix `$ACTION_` 2. Remove the obsolete mention of `.entries()`, since that is not being used in the code example anymore (previously, it was `const rawFormData = Object.fromEntries(formData.entries())`) ### History - The `$ACTION_` property change was added in https://github.com/vercel/next.js/pull/63048 - The `docs/01-app/02-guides/forms.mdx` file was added in PR https://github.com/vercel/next.js/pull/79288 , without the `$ACTION_` property change cc @delbaoliveira Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Jiwon Choi authored
Reverts vercel/next.js#84239 [slack thread](https://vercel.slack.com/archives/C06DGJ420TZ/p1760022841341369?thread_ts=1759907388.654779&cid=C06DGJ420TZ)
-
Jiwon Choi authored
### Why? When SSG, the pages can bail out when detected a dynamic usage. However, the routes that bailed out were still marked as SSG, which can confuse the users. ### How? Remove the bailed-out routes from the SSG routes list. If there are no more SSG routes for the dynamic route, mark it as dynamic in Build CLI. #### Before - Has 1, 2, 3, even though they bailed. ``` Route (app) Size First Load JS ┌ ○ /_not-found 0 B 114 kB └ ● /[id] 0 B 114 kB ├ /1 ├ /2 └ /3 + First Load JS shared by all 114 kB ├ chunks/29c57ad6b43f6070.js 75.8 kB ├ chunks/df142624801412ea.js 24.3 kB └ other shared chunks (total) 13.5 kB ○ (Static) prerendered as static content ● (SSG) prerendered as static HTML (uses generateStaticParams) ``` #### After - No longer has 1, 2, 3, and the route is marked as dynamic. ``` Route (app) Size First Load JS ┌ ○ /_not-found 0 B 114 kB └ ƒ /[id] 0 B 114 kB + First Load JS shared by all 114 kB ├ chunks/4963d796c068bb13.js 24.3 kB ├ chunks/f59bbf014aa0eff6.js 75.8 kB └ other shared chunks (total) 13.5 kB ○ (Static) prerendered as static content ƒ (Dynamic) server-rendered on demand ``` Fixes https://github.com/vercel/next.js/issues/76507 Closes NAR-194 --------- Co-authored-by:Wyatt Johnson <accounts+github@wyattjoh.ca>
-
brock-statsig authored
### What? Statsig is a popular AB Testing/ Feature Flagging solution to use in concert with Next.js. Today, their newest Server SDK doesn't play nicely with Next as its build around a Rust library, which doesn't play nice with webpack and causes build issues. ### Why? This'll remove a step for Statsig/Next developers having to troubleshoot and add @statsig/statsig-node-core to serverExternalPackages themselves. ### How? Added to the list published here: https://nextjs.org/docs/app/api-reference/config/next-config-js/serverExternalPackages
-
Steven authored
We took a look at unique Next.js projects that have one or more requests for a specific image size and here are the findings as seen from the Image Optimization API: - `w=16` 4.2% - `w=32` 17.1% - `w=48` 21.4% - `w=64` 22.6% - `w=96` 25.8% - `w=128` 29.5% - `w=256` 46.5% - `w=384` 35.1% - `w=640` 57.2% Only 4.2% of Next.js projects ever made a request to a 16px width image. This is low enough to remove from the default configuration so that all other projects can benefit from reduced html [srcset](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset) and fewer variations exposed from the backend API. You might think that this means few developers are using `<Image width={16} />` but it probably means that most displays nowadays use devicePixelRatio 2 meaning that specifying a 16px image width will actually fetch the 32px width to ensure it won't looking blurry on your retina display. BREAKING CHANGE: this is technically a breaking change but it won't cause apps to stop working, its just 4% of them may have some requests serve a 32px image instead of 16px. Those apps can of course opt in by changing their `images.imageSizes` config back to allowing 16.
-
nextjs-bot authored
-
Tobias Koppers authored
### What? Ensure more deterministic builds
-
Sebastian "Sebbie" Silbermann authored
Fixes ``` DevErrorOverlay › sends feedback when clicking not helpful button expect(received).toEqual(expected) // deep equality - Expected - 1 + Received + 1 Array [ - "/__nextjs_error_feedback?errorCode=E794&wasHelpful=false", + "/__nextjs_error_feedback?errorCode=E209&wasHelpful=false", ] ``` -- https://github.com/vercel/next.js/actions/runs/18360913450/job/52306369449#step:34:793 -
Benjamin Woodruff authored
If `isSymlink` is `true`, then none of the branches that check for `isDirectory` can be taken, so following symlinks to set `isDirectory` to `true` is useless. This more closely mirrors most recursive directory deletion algorithms out there, which skip symlink resolution entirely. ## History This logic was added in: https://github.com/vercel/next.js/pull/27779 And the symlink logic was nerfed in: https://github.com/vercel/next.js/pull/82191
-
Wyatt Johnson authored
## What Fixes an issue where internal route normalization markers (`_NEXTSEP_`) were leaking into compiled URLs for interception routes with adjacent dynamic parameters. ## Why When Next.js normalizes route patterns like `/photos/(.):author/:id` for path-to-regexp validation, it inserts `_NEXTSEP_` as a literal separator between adjacent parameters. This internal marker was appearing in the final compiled URLs (e.g., `/photos/(.)_NEXTSEP_next/123` instead of `/photos/(.)next/123`), exposing implementation details to users. ## How - Modified `safeCompile` to wrap the path-to-regexp compiler when normalization is applied - The wrapper calls `stripNormalizedSeparators` to remove the internal marker from compiled output - Added targeted regex pattern that only strips separators after interception route markers (`)_NEXTSEP_` → `)`) - Preserved separators in user content that legitimately contains this string NAR-431
-
Wyatt Johnson authored
### What? Fixes interception routes with dynamic parameters that were generating rewrite rules in an incorrect format, preventing proper URL rewriting by Vercel and Next.js. ### Why? The failing test `parallel-routes-and-interception-nested-dynamic-routes` revealed that interception routes with dynamic segments weren't working correctly when deployed. The root cause was that the previous implementation using `safePathToRegexp` produced rewrite destinations that weren't in a format compatible with direct parameter substitution during the rewrite process. When the router tried to rewrite URLs to their intercepted destinations, the parameter format prevented Vercel/Next.js from properly substituting the captured values, causing routes to fail. ### How? Completely rewrote the `generate-interception-routes-rewrites` logic to use `getNamedRouteRegex` instead of `safePathToRegexp`. This ensures: 1. **Correct rewrite format**: Rewrites are now generated in a format that allows direct parameter substitution 2. **Parameter consistency**: Source regex is generated first, then its parameter reference is passed to destination generation to ensure parameter names match for substitution 3. **Clean URLs**: Added `stripNormalizedSeparators` to prevent `_NEXTSEP_` internal separator from leaking into client-facing URLs 4. **Stricter matching**: Updated router reducers to pass `next-url` header for the stricter Next-Url regex matching required by the new rewrite mechanism **Testing:** - Added 23 comprehensive tests for rewrite generation covering all interception marker types - Added 18 tests for route matching utilities - All existing tests pass including the previously failing `parallel-routes-and-interception-nested-dynamic-routes` Fixes the failing test: `test/e2e/app-dir/parallel-routes-and-interception-nested-dynamic-routes/parallel-routes-and-interception-nested-dynamic-routes.test.ts` NAR-432
-
Jiwon Choi authored
Using Node.js native TS resolution is great. However, enabling by default can be frustrating for the users as it has restrictions, such as requiring a file extension for imports, and does not read tsconfig.json (no import alias). It also emits a warning when using `next.config.ts` on a CommonJS project, which is the majority of the apps: ``` (node:68710) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///.../next.config.ts is not specified and it doesn't parse as CommonJS. Reparsing as ES module because module syntax was detected. This incurs a performance overhead. To eliminate this warning, add "type": "module" to /.../package.json. (Use `node --trace-warnings ...` to show where the warning was created) ``` Therefore, put this under an `--experimental-next-config-strip-types` flag for now.
-
Vercel Release Bot authored
This auto-generated PR updates the production integration test manifest used when testing Rspack.
-
Jiwon Choi authored
We recommend users avoid relying on Middleware unless no other options exist. Our goal is to give them APIs with better ergonomics so they can achieve their goals without Middleware. The term “middleware” often confuses users with Express.js middleware, which can encourage misuse. To clarify our direction, we are renaming the file convention to “proxy.” This highlights that we are moving away from Middleware, breaking down its overloaded features, and making the Proxy clear in its purpose. `proxy.js` should be a drop-in replacement for `middleware.js` for its features, but ONE thing: ```diff - export function middleware + export function proxy ``` Codemod: https://github.com/vercel/next.js/pull/84127 --------- Co-authored-by:
Benjamin Woodruff <benjamin.woodruff@vercel.com>
-
Wyatt Johnson authored
This hard deprecates the `experimental.ppr` configuration, requiring users to opt-in instead via `experimental.cacheComponents`. This does mean that the previous `experimental.ppr = "incremental"` will no longer be supported. NAR-433
-
Wyatt Johnson authored
### Fixing a bug - Tests added with comprehensive e2e test suite for parallel route navigations - Error handling improved with clearer error messages for missing dynamic parameters ### What? Fixes incorrect parameter interpolation where catchall parameters in parallel routes included unintended prefix segments. ### Why? In parallel routes with dynamic catchall parameters, the parameter interpolation was incorrectly including prefix segments from the route path. For example, with a route structure like `/[teamSlug]/@slot/[...catchAll]`, a request to `/vercel/test/path` would incorrectly set `catchAll = ["vercel", "test", "path"]` instead of the correct `catchAll = ["test", "path"]`. This bug affected the accuracy of dynamic parameter values in parallel routes, leading to incorrect behavior in applications relying on these parameters for routing logic. ### How? - Introduced `interpolateParallelRouteParams()` function that properly handles path depth traversal for complex route structures - Refactored parameter interpolation to occur earlier in the render process, ensuring consistency across both postponed and regular rendering scenarios - Updated the `getDynamicParam()` function to use pre-interpolated parameters instead of performing inline path parsing - Added comprehensive e2e tests to cover various parallel route navigation scenarios and parameter interpolation edge cases - Improved error handling with more descriptive error messages for missing dynamic parameters The fix ensures that dynamic parameters are correctly extracted based on their position in the route hierarchy, respecting the boundaries defined by parallel route slots. NAR-335
-
Zack Tanner authored
Sets eslint as the default linter when using recommended defaults.
-
Zack Tanner authored
Saw this flaking when deployed. This switches it to use `router-act` which more consistently passes in my testing.
-
Jiwon Choi authored
Stacked to https://github.com/vercel/next.js/pull/84119 This PR adds a codemod for renaming `middleware` to `proxy`. Below are the behaviors: - Rename `middleware.*`, `src/middleware.*` to `proxy.*`, `src/proxy.*` - Rename function/variable exports from `middleware` to `proxy`. Default exports are skipped.
-
Zack Tanner authored
We're starting to use this pattern in more places, so this moves `router-act` into our top level testing utils.
-
Sebastian "Sebbie" Silbermann authored
-
Zack Tanner authored
Flake detection runs changed test(s) 6 times: 3 in Webpack, 3 in Turbopack. for the purposes of detecting flakes, and to reduce the burden on CI, this runs flake detection only with Turbopack (esp. now that it's enabled by default).
-
- 08 Oct, 2025 3 commits
-
-
Sam Selikoff authored
In https://github.com/vercel/next.js/pull/83003, `legacyBehavior` and `passHref` were removed from `<Link>`. However, this turned out to be a bit premature—despite most usage being covered by the newer `<Link>` APIs, there's some use cases we don't yet have good alternatives for. We expect to solve this with an API that uses Fragment Refs once they're available in React. For now, we're re-enabling these flags. --------- Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
Ben Gubler authored
### What? This PR removes the automatic ESLint linting that previously ran during `next build`. The documentation has been updated to reflect this change. ### Why? As part of Next.js 16, we're removing the automatic build-time linting that was previously included in the build process. This gives developers more control over when linting runs by explicitly invoking their linter via npm scripts. ### How? - Updated documentation to clarify that automatic build-time linting has been removed in Next.js 16 - Removed the `runLint` parameter and related linting code from the build process - Removed the `verifyAndLint.ts` file which is no longer needed - Simplified type checking code by removing lint-related functionality - Removed ESLint telemetry during builds
-