- 10 Mar, 2026 6 commits
-
-
nextjs-bot authored
-
Will Binns-Smith authored
This adds the following to uploaded trace data: - Git branch/ref name - Whether the trace was uploaded from a Vercel environment - Prefers Vercel git environment variable data over running git Test Plan: Ran a manual test app with EXPERIMENTAL_FLAGS_DEBUG=1, set the corresponding environment variables and confirmed they were reflected
-
Steven authored
Some users have been confused by the relationship of `images.remotePatterns` and `images.maximumRedirects` so lets document it. This behavior is expected since you might allowlist something like `https://github.com/styfle.png` and that can redirect to whatever it needs to redirect to (assuming maximumRedirects > 0). For example, it currently redirects to `https://avatars.githubusercontent.com/u/229881?v=4` but you can imagine in the future if the redirect was changed, you wouldn't want your app to break. Regardless of redirects, the final response must be an image. --------- Co-authored-by:
Zack Tanner <1939140+ztanner@users.noreply.github.com>
-
Sam Selikoff authored
Updates the Instant Navs devtools functionality to use a panel and show you two options for capturing the SSR shell or the prefetch for a Client navigation. Replaces current functionality where clicking Instant Navs changed the devtools indicator to a blue pending state awaiting the user's next navigation. https://github.com/user-attachments/assets/de5c5a40-e836-4719-9517-6d5c6b0aef2c
-
nextjs-bot authored
-
Niklas Mischkulnig authored
Previously, we used `RuleCondition::ReferenceType(ReferenceType)`. But there are some problem with using the type itself as a matcher: 1. the sub types' Undefined variant (like `CssReferenceSubType::Undefined`) always matched all possible variants. So it was actually impossible to match exactly `CssReferenceSubType::Undefined` 2. variants with more complex types were also impossible to match against, like `ReferenceType::Inner(ResolvedVc<...>)`
-
- 09 Mar, 2026 19 commits
-
-
nextjs-bot authored
-
Benjamin Woodruff authored
**Rendered:** https://github.com/vercel/next.js/blob/dd1cc6fba3cff5fbc38dac3ff4426b481bfcbcb5/contributing/turbopack/tracing.md This is the content from https://turbopack-rust-docs.vercel.sh/tracing_turbopack.html with some minor updates: - Use GitHub Flavored Markdown for the warning block - Some grammar fixes/tweaks - Add an extra note about `--release` being important - Add a mention of `pnpm next internal trace` - Add a link to @timneutkens's youtube video - Change the filepath from the old confusingly named `.next/trace.log` to `.next/trace-turbopack` - Add a link to https://trace.nextjs.org/
-
nextjs-bot authored
-
Zack Tanner authored
## Summary Fix an App Router request normalization gap where app-page route-module requests could keep internal RSC/segment-prefetch URLs in `req.url`. This could leak paths like: - `.../.segments/_tree.segment.rsc` - `.../__PAGE__.segment.rsc` into App Router render state and surface through `usePathname()` during server rendering. ## What changed - Normalize `req.url` in the app-page route-module path after `.rsc` and `.segments/*.segment.rsc` pathname normalization. ## Why `base-server` already keeps `req.url` in sync after RSC normalization ([ref](https://github.com/vercel/next.js/blob/5e11e67759fa38fe67f70790d7bba8c9ff9ba5fd/packages/next/src/server/base-server.ts#L676-L680)), but the app-page route-module path only updated `parsedUrl.pathname`. Since App Router render state seeds its canonical URL from `req.url`, that desync could cause internal segment-prefetch paths to be treated as the current pathname.
-
Zack Tanner authored
This puts the partial fallback upgrading feature introduced in https://github.com/vercel/next.js/pull/89063 behind a flag to make it easier to test the rollout/eventual stabilization in isolation.
-
Will Binns-Smith authored
`is_hot_module_replacement_enabled` was removed from ChunkingContexts. Instead, pass it through from CompileTimeInfo when constructing ImportMetaBinding during analysis. Test Plan: CI
-
Benjamin Woodruff authored
A lot of stuff here was slightly out-of-date or not as helpful as it could be. For the Linux bits, I tested with a fresh Ubuntu image in LXD.
-
Tobias Koppers authored
### What? Implements dependency-level HMR accept and decline for Turbopack, covering both ESM (`import.meta.turbopackHot`) and CJS (`module.hot`) modules. Previously Turbopack only supported self-accept (`module.hot.accept()` with no arguments) and self-decline. This PR adds the full dependency-targeted API: - `module.hot.accept(dep, cb)` / `import.meta.turbopackHot.accept(dep, cb)` — single dep - `module.hot.accept([depA, depB], cb)` / `import.meta.turbopackHot.accept([depA, depB], cb)` — array of deps - `module.hot.decline(dep)` / `import.meta.turbopackHot.decline(dep)` — single dep - `module.hot.decline([depA, depB])` / `import.meta.turbopackHot.decline([depA, depB])` — array of deps ### Why? Libraries like `react-refresh` and user code often need to accept updates for specific dependencies rather than self-accepting the entire module. Without this, those HMR patterns fall back to full page reloads in Turbopack. ### How? **Runtime** (`turbopack-ecmascript-runtime`): - Extended `HotState` with `acceptedDependencies`, `acceptedErrorHandlers`, and `declinedDependencies` maps (keyed by `ModuleId`) - Updated `hot.accept()` and `hot.decline()` to handle string and array signatures - Updated `getAffectedModuleEffects` to check accepted/declined dependencies when propagating updates through the module graph - Added `'declined'` effect type that throws an `UpdateApplyError` - Track `outdatedDependencies` (map of parent → set of updated deps) alongside `outdatedModules` - In the apply phase, invoke per-dependency accept callbacks with the correct outdated deps - Use `Set` for `outdatedDependencies` dedup (O(1) vs O(n) lookups) **Compiler** (`turbopack-ecmascript`): - Added `ModuleHotReferenceAssetReference` — a single asset reference type for both accept and decline deps, with shared resolve logic for ESM (`esm_resolve`) and CJS (`cjs_resolve`) - Added `ModuleHotReferenceCodeGen` — generates code that replaces dep string literals with resolved module IDs at compile time - ESM binding auto-update: when an ESM module accepts a dependency that it also `import`s, the compiler wraps the accept callback to re-import the namespace variable (`__TURBOPACK__imported__module__<id> = __turbopack_import__(<id>)`) before the user callback runs, so ESM bindings reflect updated values without needing `require()` - Added `import.meta.turbopackHot` as the ESM equivalent of `module.hot`, with TypeScript type declarations in `packages/next/types/global.d.ts` - Static analysis extracts dep strings from `module.hot.accept`/`decline` calls; non-analyzable deps emit a warning with distinct error codes (`TP1204` for accept, `TP1205` for decline) **HMR gating** (`CompileTimeInfo`): - Added `hot_module_replacement_enabled` flag to `CompileTimeInfo` to gate recognition of `module.hot` and `import.meta.turbopackHot` as well-known objects - Without this flag, production builds would recognize `module.hot.accept(...)` and generate HMR-specific code, leading to runtime errors - Flag set to `true` for dev servers and `false` for production builds across Next.js and turbopack-cli entry points - `import.meta.turbopackHot` getter is only emitted when HMR is enabled **Server HMR** (`next-api`, `next-core`): - Server-side `compile_time_info` now also sets `hot_module_replacement_enabled` so that `module.hot` / `import.meta.turbopackHot` are recognized during analysis of server modules - Server HMR requires the `--experimental-server-fast-refresh` CLI flag; the flag is passed through `ProjectOptions` to the Rust side so `server_compile_time_info` only enables HMR when appropriate **Tests** (`test/development/app-dir/hmr-dep-accept/`): - ESM single dep accept — verifies parent module is not re-evaluated, accept callback fires, ESM bindings auto-update - ESM array dep accept — same as above with `accept(['./dep-a', './dep-b'], cb)` - CJS `module.hot.accept` — pure CJS dep observer pattern with `.cjs` files - Single dep decline — verifies full page reload occurs - Array dep decline — verifies full page reload with `decline(['./dep-a', './dep-b'])`
-
Tobias Koppers authored
### What? Improves safety documentation for all `unsafe` code in the `turbo-tasks-backend` crate (6 files, comment-only changes). ### Why? A comprehensive audit of all 14 files containing `unsafe` code in `turbo-tasks-backend` found **no soundness bugs**, but identified several safety comments that were incorrect, misleading, or missing entirely. Correct safety documentation is critical for maintaining unsafe code over time — reviewers and future contributors rely on these comments to understand invariants. ### How? **Fixes applied (comment-only, no behavior changes):** 1. **`backend/operation/mod.rs`** — Fixed transmute safety comment that referenced wrong lifetime names (`'a`/`'l` → `'e`/`'tx`) 2. **`database/read_transaction_cache.rs`** — Fixed reference to wrong struct name (`LmdbBackingStorage` → `ReadTransactionCache`); added struct-level doc explaining the field-ordering invariant required for drop safety 3. **`database/startup_cache.rs`** — Added struct-level doc explaining the self-referential pattern and field-ordering invariant; improved inline safety comment 4. **`utils/dash_map_multi.rs`** — Added safety justification for `unsafe impl Send/Sync` on `RefMut` explaining bucket pointer exclusivity 5. **`backing_storage.rs`** — Added `// Safety:` comments to 6 `unsafe` blocks in the `Either` impl that were missing them 6. **`kv_backing_storage.rs`** — Made the `flush()` safety comment more specific about what "finished processing" means **Audit summary (14 files reviewed):** | Risk | Category | Files | Verdict | |------|----------|-------|---------| | HIGH | Lifetime transmutation | 3 | Sound ✓ — comments fixed | | MEDIUM | DashMap raw bucket access | 3 | Sound ✓ — Send/Sync docs added | | LOW | Unsafe trait method contracts | 8 | Sound ✓ — missing comments added | | NEGLIGIBLE | Test code | 1 | No issues |
-
Tobias Koppers authored
### What? Adds `@next/swc-linux-x64-gnu` to the preview tarball patching script (`scripts/patch-preview-tarball.mjs`): 1. Adds the package to the `PACKAGES_TO_PATCH` list so its tarball URL is fetched. 2. Adds the package as an explicit dependency in the patched `package.json`, in addition to the overrides/resolutions. ### Why? The `@next/swc-linux-x64-gnu` native binary package is an optional dependency of `next` and may not be installed automatically depending on the platform/package manager. When testing preview tarballs (e.g., in CI or on Linux environments), the SWC binary needs to be explicitly present for Next.js to function correctly. Without this change, preview tarball testing on Linux x64 could fail because the native binary isn't resolved from the preview build. Adding it as a direct dependency (not just an override/resolution) ensures the package manager actually installs it, since optional dependencies from overridden tarballs may not be auto-resolved. ### How? - Added `'@next/swc-linux-x64-gnu'` to the `PACKAGES_TO_PATCH` array so the script fetches its tarball URL. - After writing overrides/resolutions, the script now also adds `@next/swc-linux-x64-gnu` as an explicit entry in `pkg.dependencies` pointing to the tarball URL. Co-authored-by:Claude Opus 4.6 <noreply@anthropic.com>
-
Kowyo authored
Removed duplicate entries for cache and temporary directories. ```diff - # Cache directories and temporary data - .cache/ - .parcel-cache/ - .eslintcache - .stylelintcache - .turbo/ - .tmp/ # Cache directories and temporary data .cache/ .parcel-cache/ .eslintcache .stylelintcache .swc/ .turbo/ .tmp/ .temp/ ``` Co-authored-by:Joseph <joseph.chamochumbi@vercel.com>
-
Ethan (Taehoon) Lee authored
### What? Enhance the documentation about how to use the `localFont` function. ### Why? The Next.js documentation about [local fonts](https://nextjs.org/docs/app/getting-started/fonts#local-fonts) has insufficient information about where to store the font files and how to reference them with the `localFont` function. The lack of detail causes confusion like this issue: https://github.com/vercel/next.js/issues/76573. ### How? I created a [demo](https://nextjs-localfont-demo.vercel.app/) to investigate the behavior of the `localFont` function (source: https://github.com/ethn1ee/nextjs-localfont-demo). I confirmed that the font files can be located anywhere inside the project, including at root, the `src` directory, the `app` directory, and the `public` directory, and that they must all be referenced using relative paths. Fixes #76573 --------- Co-authored-by:
Ethan Lee <48551278+ethn1ee@users.noreply.github.com> Co-authored-by:
Joseph <sephxd1234@gmail.com> Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Joseph authored
Trying to fix: `lerna ERR! ENOGIT Detached git HEAD, please checkout a branch to choose versions.` on `set-preview-version.js` [Slack thread](https://vercel.slack.com/archives/C02CDC2ALJH/p1773051154649349)
-
Niklas Mischkulnig authored
Turn into bail to handle eventual consistency more gracefully
-
Tobias Koppers authored
## Summary `getFailedJobs()` in `scripts/pr-status.js` used jq's `select(.conclusion == "failure")` filter during GitHub API pagination. When a page had 100 jobs but none were failures, jq returned empty output, and the `if (!output.trim()) break` check terminated the pagination loop early — never fetching page 2+ where actual failures existed. For example, on PR #90755 (129 total jobs), all 100 jobs on page 1 were success/skipped, while the 2 failures (`test unit windows (22) / build` and `thank you, next`) were on page 2 (jobs 101-129). The script reported "Found 0 failed jobs" when there were actually 2. ## Fix `getFailedJobs()` now delegates to `getAllJobs()` (which fetches all jobs without jq filtering, so pagination works correctly) and filters for failures in JavaScript afterward. This is simpler and avoids the class of bug where jq pre-filtering interacts badly with pagination. ## Test Plan - Ran `node scripts/pr-status.js 90755` before fix: reported 0 failed jobs - Ran `node scripts/pr-status.js 90755` after fix: correctly reported 2 failed jobs (`test unit windows (22) / build` and `thank you, next`)
-
Tobias Koppers authored
### What? Adds a new script `scripts/patch-preview-tarball.mjs` that patches a target project's `package.json` to use Next.js preview tarballs from `vercel-packages.vercel.app`. ### Why? When testing unreleased Next.js changes against external projects (e.g., reproducing bugs, verifying fixes), there's no convenient way to point a project at a specific Next.js commit's build artifacts. This script automates the process of wiring up preview tarball URLs into a project's dependency overrides. ### How? The script: 1. **Resolves a commit SHA** via one of three methods: - `--commit <sha>` — use an explicit commit - `--branch <name>` — look up the branch tip via the GitHub API (`gh`) - *(default)* — use the local `git rev-parse HEAD` 2. **Builds tarball URLs** for `next`, `@next/mdx`, `@next/env`, and `@next/bundle-analyzer` using the `vercel-packages.vercel.app/next/commits/<sha>/<pkg>` pattern. 3. **Verifies** that the preview tarball exists (HEAD request to the `next` tarball URL). 4. **Patches `package.json`** in the target project (or its workspace root) by setting both `overrides` (npm/pnpm) and `resolutions` (yarn) for the packages. **Usage:** ```bash node scripts/patch-preview-tarball.mjs --project <path> [--commit <sha> | --branch <name>] ```
-
Niklas Mischkulnig authored
I don't think we have any tests that the server utility chunking actually works. But I can't actually properly remember why we added it in the first place: https://github.com/vercel/next.js/pull/70461
-
Tobias Koppers authored
## What? This PR improves error reporting for webpack loaders by: 1. **Preserving loader paths in error messages**: Modified the webpack message formatter to rewrite "Module build failed" headers to preserve the loader path information while removing the verbose prefix. This makes errors more readable in both CLI output and error overlays. 2. **Better error wrapping for non-Error throws**: When loaders throw non-Error values (strings, objects, etc.), the error is now wrapped with loader path information in the stack trace, making it easier to identify which loader caused the error. 3. **Catching deferred loader errors**: Added handling for errors that occur after loader completion (e.g., unhandled Promise rejections, setTimeout throws) by: - Adding an `unhandledRejection` handler in the IPC layer - Delaying resolution in webpack-loaders transform to allow error handlers to fire before sending the 'end' message 4. **Conditional `(from ...)` annotation**: The `(from /path/to/loader.js)` annotation is only added when the loader path is **not already visible** in the error's stack trace. This avoids redundant noise for errors that already include the loader in their stack, while still providing the annotation for errors without loader context (string throws, errors without stacks, etc.). 5. **Hiding internal Next.js loader paths**: Internal Next.js loader paths (under `next/dist/`) are filtered from error messages since they're noise for users. Only user-authored loader paths are shown. 6. **Comprehensive test coverage**: Added e2e tests covering various error scenarios (Error throws, string throws, Promise rejections, setTimeout errors, no-stack errors, filesystem errors) with verification of both CLI output and error overlay display. ## Why? Webpack loader errors were previously difficult to debug because: - The verbose "Module build failed" prefix obscured the actual error message - Non-Error throws lost their context and loader information - Deferred errors (Promise rejections, async throws) were not properly surfaced - Error overlays didn't clearly show which loader caused the problem - The `(from ...)` annotation was always added, even when the loader path was already in the stack trace (addressed per review feedback) ## How? - **format-webpack-messages.ts**: Changed from filtering out loader headers to rewriting them, preserving the `(from ./loaders/...)` information. Internal Next.js loader paths are hidden. - **webpack-loaders.ts**: Added error wrapping for non-Error values, deferred resolution to catch async errors, and conditional `(from ...)` annotation that checks `err.stack` before appending. Resolves loader paths into an array, then checks if any path appears in the stack before deciding to annotate. - **ipc/index.ts**: Added `unhandledRejection` handler to surface Promise-related errors. - **Test loaders**: `error-loader.js` and `fs-error-loader.js` delegate to a `create-error.js` helper that creates errors and invokes the loader callback inside `setTimeout`. This ensures the loader file path is absent from the stack trace, exercising the conditional `(from ...)` annotation path. Other loaders (string-error, promise-error, timeout-error, no-stack-error) test different error scenarios directly. - **Test suite**: Comprehensive e2e tests verify CLI output and error overlay for each error type. Turbopack-specific tests cover promise rejections, timeout errors, no-stack errors, and filesystem errors. --------- Co-authored-by:Claude <noreply@anthropic.com>
-
Tobias Koppers authored
### What? Changes Turbopack's error overlay to show specific SWC diagnostic messages as the error title instead of generic messages like "Parsing ecmascript source code failed" or "Ecmascript file had an error". ### Why? Previously, all SWC parse/analysis errors in Turbopack showed a generic title (e.g. "Parsing ecmascript source code failed") in the redbox header, with the actual specific error message buried in the description below the code frame. This made it harder for developers to quickly understand what went wrong. **Before:** ``` Parsing ecmascript source code failed > 1 | export default () => <div/ | ^ Expected '>', got '<eof>' ``` **After:** ``` Expected '>', got '<eof>' > 1 | export default () => <div/ | ^ Parsing ecmascript source code failed ``` ### How? **Core change** in `turbopack/crates/turbopack-swc-utils/src/emitter.rs`: When the `IssueEmitter` has a `self.title` set (the generic title like "Parsing ecmascript source code failed"), the SWC diagnostic message is now used as the issue title, and the generic title is demoted to the description. When `self.title` is not set, the existing behavior is preserved (first line of message becomes title, rest becomes description). **Test updates** across ~15 test files: Updated all `isTurbopack` branches in test expectations to reflect the swapped title/description. Only Turbopack-specific branches were modified; webpack and rspack expectations are unchanged. **New test suite** (`test/development/app-dir/ecmascript-error-title/`): Dedicated tests verifying that both syntax errors (e.g. `Expected '>', got '<eof>'`) and analysis errors (e.g. `the name 'Table' is defined multiple times`) show the specific SWC message as the redbox title. **Turbopack snapshot updates:** 4 snapshot files renamed to reflect new titles (e.g. `Parsing ecmascript source code failed-*.txt` → `Expression expected-*.txt`). --------- Co-authored-by:Claude <noreply@anthropic.com>
-
- 07 Mar, 2026 4 commits
-
-
nextjs-bot authored
-
Niklas Mischkulnig authored
Now all of the chunking context functions accept `ChunkGroup` The names are bad, but `entry_chunk_group` and `ChunkGroup::Entry` have nothing to do with each other: - `entry_chunk_group` means: it's a standalone file where `node path/to/chunk.js` will execute it - `ChunkGroup::Entry` = it's the top-level chunk group For example a `evaluated_chunk_group(ChunkGroup::Entry)` is also fine
-
JJ Kasper authored
## Summary - interpolate source and `has` captures in `@next/routing` route headers anywhere destinations are already interpolated - make `onMatch` headers respect route matching and capture interpolation instead of applying unconditionally - keep middleware and initial request headers internal to routing so `resolvedHeaders` only contains actual response headers - add regressions for header interpolation and for request-header leakage into `resolvedHeaders` ## Testing - `pnpm --dir packages/next-routing types` - `pnpm --dir packages/next-routing test -- --runInBand`
-
Joseph authored
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> <!-- 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? Improve the `errors/large-page-data.mdx` error page. ### Why? The existing error page lacked clarity on the `__NEXT_DATA__` mechanism, performance impacts, configuration options, and its applicability solely to the Pages Router. This led to confusion, as highlighted in community discussions: - https://github.com/vercel/next.js/discussions/38364#discussioncomment-3090327 - https://github.com/vercel/next.js/discussions/60193#discussioncomment-8010640 ### How? - Added a note clarifying this warning applies only to the Pages Router. - Explained the `__NEXT_DATA__` mechanism, why the threshold exists, and its performance implications (page weight, hydration, memory). - Provided actionable suggestions to reduce data size (filter, paginate, client-side fetching). - Documented the `experimental.largePageDataBytes` configuration option with a `next.config.js` example. - Included relevant external links for further reading. Closes NEXT- Fixes # --> --- [Slack Thread](https://vercel.slack.com/archives/C08N392Q9EV/p1772698459867909?thread_ts=1772698459.867909&cid=C08N392Q9EV) <p><a href="https://cursor.com/agents/bc-f75e35d4-cde9-5300-8c76-b4a67c24d55f"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-f75e35d4-cde9-5300-8c76-b4a67c24d55f"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </p> <!-- CURSOR_AGENT_PR_BODY_END --> --------- Co-authored-by:
Cursor Agent <cursoragent@cursor.com> Co-authored-by:
Joseph <icyJoseph@users.noreply.github.com>
-
- 06 Mar, 2026 11 commits
-
-
nextjs-bot authored
-
Jonas Herrmannsdörfer authored
## Summary - Fixes cross-zone server action redirect failure where `redirect()` inside a server action produces a blank page when the target path is served by a different Next.js zone (separate Vercel project, same domain) - Adds build ID validation to `server-action-reducer.ts`, matching the existing pattern in `fetch-server-response.ts` - Adds e2e test in the deployment-skew test suite to verify server action redirects with build ID mismatch trigger MPA navigation ## Background When a server action calls `redirect()`, the server pre-fetches the redirect target and includes the RSC data in the response. In a multi-zone setup (same domain, different Next.js projects), this pre-fetched RSC data comes from a different build with a different build ID. The `fetch-server-response.ts` file already checks for build ID mismatches during regular navigations (line 245-251) and triggers MPA navigation when detected. However, `server-action-reducer.ts` was missing this check, causing the client to try to apply the foreign RSC payload — resulting in a blank page. ## Fix Added a build ID check in `fetchServerAction()` after parsing the RSC response. When a mismatch is detected, the flight data is discarded. The existing reducer logic at line 364-370 already handles this case: ```typescript if (flightData === undefined && redirectLocation !== undefined) { return completeHardNavigation(state, redirectLocation, navigateType) } ``` This triggers an MPA navigation (full page load), which is the correct behavior for cross-zone redirects. ## Repro - https://repro-main-app.vercel.app/test-redirect - Red button (server action redirect) → blank page (before fix) / full page load (after fix) - Green link (normal `<a>`) → works fine Closes https://linear.app/vercel/issue/NEXT-4856 --------- Co-authored-by:Zack Tanner <1939140+ztanner@users.noreply.github.com>
-
nextjs-bot authored
-
Tim Neutkens authored
## What? Updates the adapters docs with missing fields and more details --------- Co-authored-by:Joseph <joseph.chamochumbi@vercel.com>
-
Jude Gao authored
The `lint` job in CI has been hitting `FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory` during `lint-eslint`. `lint-no-typescript` runs `prettier-check`, `lint-eslint .`, and `lint-language` in parallel via `run-p`. The `lint-eslint` script uses `eslint.cli.config.mjs` which enables type-checked rules with `parserOptions.project: true` — the config comment itself notes this "needs a lot of memory". Node's default heap limit caps around ~2-4GB regardless of available system memory, which isn't enough when the type-aware parser loads the full monorepo project graph. This sets `NODE_OPTIONS="--max-old-space-size=8192"` on the `lint-no-typescript` script via `cross-env`. The env var inherits into all three `run-p` children, giving eslint the headroom it needs without touching CI workflow files.
-
Benjamin Woodruff authored
This method is needed with `turbo-tasks` to implement `OperationVc`, but exposing it to other crates turns it into a footgun, because it allows you to attempt to read a `Vc` or `ResolvedVc` with strong consistency, which doesn't have a well-defined meaning.
-
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Rspack.
-
nextjs-bot authored
-
Andrew Clark authored
When matching a URL against the known route trie, if a URL part matches a static child but the remaining parts don't resolve within that child's subtree, the algorithm incorrectly falls back to a dynamic catch-all sibling at the same level. This causes the catch-all to consume the already-matched static part plus the remaining parts, producing a synthetic entry for the wrong route. For example, given routes `/dashboard/settings/profile` and `/dashboard/[...catchall]`, navigating to `/dashboard/settings/profile` could incorrectly match the catch-all with params `["settings", "profile"]` instead of the intended static route. The fix treats the static child match as authoritative: if a real (non-placeholder) static child exists but its subtree can't resolve the remaining URL parts, bail out to server resolution rather than trying the dynamic sibling. This is safe because it just means an extra network request for routes whose subtree hasn't been fully discovered.
-
zoomdong authored
-
Jude Gao authored
Fixtures now live next to the code they test, like e2e. `pnpm eval <name>` packs the local `next` build, generates baseline + agents-md experiment configs on the fly, and runs both in a sandbox. The agents-md variant drops an `AGENTS.md` that points the agent at the bundled docs in `node_modules/next/dist/docs/` — comparing the two variants tells you whether shipping a doc actually changes agent behavior. `run-evals.js` mirrors `run-tests.js`: pack once, pass the tarball path to the child via `NEXT_EVAL_TARBALL` env, forward flags. We only pack `next`, not the whole workspace — the sandbox is remote Linux, so a local `@next/swc` darwin binary wouldn't run there anyway; the sandbox downloads the right one at runtime. The experiment config uses `sandbox: 'auto'`, which picks Vercel sandboxes when credentials are present and falls back to local Docker otherwise, so external contributors can run the same evals with just Docker + `ANTHROPIC_API_KEY`. `experiments/` is generated fresh each run and gitignored so we don't maintain N committed config files that differ by one line. Fixture code is excluded from eslint since it's deliberately imperfect code for agents to fix, and `EVAL.ts` uses vitest rather than jest. Fixture `package.json` files use `"next": "^16"` rather than a pinned canary so agents reading `package.json` to infer capabilities aren't misled by a stale version string; the tarball install overlays it regardless. next-evals-oss stays as the full benchmark runner for nextjs.org/evals; it'll pull fixtures from here instead of keeping its own copy.
-