33392 Commits

Author SHA1 Message Date
Sebastian Sebbie Silbermann 9bd3c26a73 v16.2.7 v16.2.7 2026-06-01 17:28:15 +02:00
Luke Sandberg c63224f3d8 [backport] feat(turbopack): add LocalPathOrProjectPath PostCSS config resolution (#94284)
Backports [feat(turbopack): add LocalPathOrProjectPath PostCSS config resolution (#91338)](https://github.com/vercel/next.js/pull/91338) to `next-16-2`.

<!-- NEXT_JS_LLM_PR -->
2026-05-31 11:12:53 -07:00
Sebastian "Sebbie" Silbermann 63115c7987 [16.2.x] Don't drop FormData entries (#94240) 2026-05-31 13:02:19 +02:00
Tim Neutkens aef22fdc82 [backport] Propagate adapter preferred regions (#94200)
Backports [Propagate adapter preferred
regions](https://github.com/vercel/next.js/pull/94123) to `next-16-2`.

<!-- NEXT_JS_LLM_PR -->
2026-05-28 20:13:11 +02:00
Tim Neutkens f126e72271 [backport] Fix "type: module" in project dir when using standalone or adapters (#94050)
Backports [Fix "type: module" in project dir when using standalone or
adapters](https://github.com/vercel/next.js/pull/93612) to `next-16-2`.

<!-- NEXT_JS_LLM_PR -->
2026-05-28 17:23:28 +02:00
Benjamin Woodruff bda3e2aabe [ci] Disable hanging node 24 typescript tests on 16.2 backport branch (#94164)
https://vercel.slack.com/archives/C0B0LKK5QD7/p1779825011578549

> I'm not having any luck reproducing this locally, and there's no
useful logs from GitHub Actions. Looking at the timestamps, it
successfully completes `pnpm install` and then hangs for 30m until it
times out.

> I'm not seeing these failures in the `canary` branch, and this only
happens with node 24. I'm just going to disable this job on the
`next-16-2` branch. The failure doesn't appear to be indicative of any
real issue on our end, it's more likely an issue with node or pnpm.

Example failure:
https://github.com/vercel/next.js/actions/runs/26503905088/job/78051437920
2026-05-27 19:32:25 +00:00
Niklas Mischkulnig 7e16e07c02 [backport] Turbopack: switch from base40 to base38 hash encoding (#93932)
Backport of https://github.com/vercel/next.js/issues/91832

For https://github.com/vercel/next.js/issues/93790 and
https://github.com/vercel/next.js/issues/92711

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: Tobias Koppers <sokra@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-05-19 09:18:30 +00:00
Hendrik Liebau 6139f4b885 [backport] Fix server action forwarding loop with middleware rewrites (#93919)
Backports:

- #93792

Co-authored-by: Elisha Greenwald <ejgreenwald@gmail.com>
Co-authored-by: LiamBoz <thisamazingnow@gmail.com>
Co-authored-by: kmaclip <kmartclips@proton.me>
2026-05-19 09:11:49 +02:00
Hendrik Liebau c021d10fe9 [backport] Encode non-ASCII characters in cache tags at construction (#93918)
Backports:

- #93617
- #93601

---------

Co-authored-by: Swarnava Sengupta <swarnava.sengupta@vercel.com>
Co-authored-by: Or Nakash <ornakash@gmail.com>
2026-05-19 09:11:13 +02:00
Hendrik Liebau 9184ddb1ae [backport] Fix catch-all router.query corruption with basePath + rewrites (#93917)
Backports:

- #93294
2026-05-19 09:07:57 +02:00
Hendrik Liebau 3279f01607 [backport] Fix dev mode hydration failure when page is served from HTTP cache (#93492)
Backports:

- #92892
- #93486
2026-05-19 09:07:13 +02:00
Hendrik Liebau ffc4f29682 [backport] Patch playwright-core to resolve _finishedPromise on requestFailed (#93920)
Backports:

- #93802
2026-05-18 18:44:07 +02:00
Joseph bc1791dd7e Backport documentation fixes for v16.2 (#93804)
## Summary

Backports documentation fixes and improvements from canary to the
`next-16-2` branch.

### Included commits:
- eddbd54f90 docs: clarify that proxy/middleware matches static assets
by default (#92441)
- 43d1229d4c docs: clarify serverless runtime behavior for use cache
(#92232)
- 630d9052c6 docs: add note on React canary version to View transitions
guide (#92315)
- 08f6f62988 docs: note PPR default in cacheComponents reference
(#92378)
- 07182b567c docs: clarify cacheLife() cannot be called at module scope
(#92326)
- 7bb8e7de84 docs: add note on installing `server-only` in data security
guide (#92445)
- 6440b9e11b docs: update details about `unstable_retry()` behavior
(#91827)
- 246c5e1f5d docs: link updateTag from cacheTag reference (#92379)
- a99d7fd16e docs: native db drivers with sync queries (#92572)
- aef9105d1b docs: add Link transitionTypes version history (#92624)
- db1d2cc398 docs(cli): clarify that `--debug-build-paths` requires
route group folders in paths (#92618)
- 82f3f48880 docs: fix broken bun.sh Nextjs documentation link (#92698)
- 5a1598608e docs: add migration note for experimental cache flags to
cacheComponents (#92318)
- d1cf752c5d docs: draftMode alignment (#92794)
- ccc6d36578 docs: amends to preserving-ui-state guide (#92270)
- 44e3208add docs: link Activity guide from Cache Components migration
guide (#92571)
- 2217cbaa8c docs: add guide for displaying dates without hydration
flash (#92786)
- d233d05456 docs: remove broken error-handling overlay screenshot
(#93279)
- 356644ba06 Update 05-server-and-client-components.mdx (#93374)
- ae88a95b5e docs: clarify rendering flow in Server/Client interleaving
example (#93381)
- b4191904d8 docs: clarify proxy runtime history (#93467)
- e41fc92a76 docs: remove unreachable forms and mutations (#93509)
- 405a912968 docs: broken link from usePathname compat call out (#93528)
- 58ea3325f1 docs: escape literal triple-backticks in contribution guide
(#93584)
- d98ea7cc67 docs: clarify cacheTag limit - it is per call (#93768)
- 7988818441 docs: devIndicators with usage example (#93784)

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Joseph <icyJoseph@users.noreply.github.com>
Co-authored-by: MK <135491799+wwenrr@users.noreply.github.com>
Co-authored-by: wwenrr <wwenrr@users.noreply.github.com>
Co-authored-by: Aurora Scharff <66901228+aurorascharff@users.noreply.github.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Abhishek Mardiya <97448460+abhishekmardiya@users.noreply.github.com>
Co-authored-by: Jiwon Choi <devjiwonchoi@gmail.com>
Co-authored-by: Hamed <55133282+hamedniroomand@users.noreply.github.com>
Co-authored-by: Jimmy Lai <laijimmy0@gmail.com>
Co-authored-by: christopherkindl <53372002+christopherkindl@users.noreply.github.com>
Co-authored-by: Zana Abdi <zana.abdi@hotmail.com>
Co-authored-by: Armando A. Calderón <armandoandrecalderon@gmail.com>
2026-05-13 00:48:44 +02:00
Sebastian "Sebbie" Silbermann ee6e79b179 v16.2.6 v16.2.6 2026-05-07 20:20:32 +02:00
Tim Neutkens afa053d9eb Turbopack: Match proxy matchers with webpack implementation (#93594)
## What?

Applies
https://github.com/vercel/next.js/commit/d166096c399c4fc4e09cd2d1bf26dca6579a855d
for canary and handles the Turbopack-side implementation for
`middleware-manifest.json` which is used for edge runtime middleware.ts

---------

Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2026-05-07 19:32:15 +02:00
Tim Neutkens 97a154e5bb Turbopack: Fix middleware matcher suffix (#93590)
## What?

The Turbopack path incorrectly included a double backslash instead of
one backslash in the regex matcher.
2026-05-07 19:32:04 +02:00
Sebastian "Sebbie" Silbermann 83899bc891 [backport] Disable build caches for production/staging/force-preview deploys (#93586)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2026-05-07 16:24:02 +02:00
Sebastian "Sebbie" Silbermann 7b222b9095 [backport][test] Pin package manager to patch versions (#93595) 2026-05-07 15:32:13 +02:00
Sebastian "Sebbie" Silbermann a8dc24f1fe [backport] Turbopack: more strict vergen setup (#93587)
Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2026-05-07 12:38:02 +02:00
Sebastian "Sebbie" Silbermann 766148f9cd v16.2.5 v16.2.5 2026-05-06 19:06:11 +02:00
Zack Tanner 0dd94836a8 fix: add explicit checks for RSC header (#83) (#98)
(cherry picked from commit 807e363b13cc9395aa74f75122d1d16b4a46dc1a)
2026-05-06 18:02:07 +02:00
Zack Tanner d166096c39 fix proxy matching for segment prefetch URLs (#89) (#96)
* fix: proxy should match segment prefetches for canonical urls

* include .rsc handling
2026-05-06 18:02:06 +02:00
Josh Story 9d50c0b719 Strip next-resume header from incoming requests (#92)
This header is used by proxies to perform a concatenating resume render for partial prerendering. It is never sent from the client so we can filter it out when running in a mode that does not have an intermediate proxy.
2026-05-06 18:02:06 +02:00
Zack Tanner df7ab5ad72 fix: skip internal param normalization in unsupported environments 2026-05-06 18:02:06 +02:00
Josh Story ed41d1d454 Move htmlescape to shared/lib (#91)
we have auditing that server files aren't included in client chunks but the new htmlescape usage in next/script is causing that validation to fail. This refactors the utility into lib/shared
2026-05-06 18:02:06 +02:00
JJ Kasper b4c6705c70 Ignore malformed CSP nonce headers 2026-05-06 18:02:06 +02:00
JJ Kasper 5b194ee2d4 router-server: guard upgrade proxy against absolute-url SSRF (#77)
* test: add rewrite request smuggling coverage

* router-server: guard upgrade proxy against absolute-url SSRF

* test: relax rewrite smuggling socket timeout

* router-server: preserve local websocket upgrades
2026-05-06 18:02:02 +02:00
JJ Kasper cb171d7494 Fix i18n middleware matching for default-locale data routes (#82)
* Fix i18n middleware matching for default-locale data routes

* unskip node middleware on deploy
2026-05-06 17:59:10 +02:00
Sebastian "Sebbie" Silbermann 89e995431a [16.x] Type hardening and performance improvements (#80) 2026-05-06 17:59:10 +02:00
Josh Story 66f6017f15 Escape properties for beforeInteractive scripts (#86)
props set on a next/script with beforeInteractive are serialized as JSON into an inline script to be exectuted prior to hydration by Next.js. The props were not additionally escaped and if user input was rendered as through a script it could allow fro XSS. This has alwways been true if you pass user input into the script body or via dangerouslySetInnHTML however and it is always the developers responsibility to sanitize user input before rendering. However wherever React has some automatic escaping to act as an additional defense against common mistakes leading to vulnerabilities like XSS Next.js should mirror that becasue from the user's perspective it is not clear that React is not directly rendering the script props and content.

This change adds additional escaping so that serialized properties cannot break out of the script scope and execute unexpected payloads.
2026-05-06 17:59:10 +02:00
Hendrik Liebau 3d98505a24 [backport] fix: preserve HTTP access fallbacks during prerender recovery (#93470)
Backports:

- #92231

---------

Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
Co-authored-by: Andrew Clark <git@andrewclark.io>
2026-05-06 14:49:29 +02:00
Hendrik Liebau bb5ada6e38 [backport] [test] Deflake instant-navs-devtools (#93534)
Backports:

- #91912
- #93365

---------

Co-authored-by: Sebastian "Sebbie" Silbermann <sebastian.silbermann@vercel.com>
2026-05-06 14:07:02 +02:00
Hendrik Liebau f1c11203d5 [backport] Fix double-encoding of URL pathname parts in client param parsing (#93506)
Backports:

- #93491
2026-05-06 11:51:44 +02:00
Hendrik Liebau 2d08397b3d [backport] fix accidental test duplication (#93507) 2026-05-05 23:54:20 +02:00
Josh Story 75d19ecbb3 [backport] Include deployment id in cacheHandlers keys (#93471)
Backport #93453 to 16.2

How was this ever working for dev? In that case, `buildId =
"development"` and so it always uses the same cache key

Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
2026-05-05 14:54:04 -07:00
Benjamin Woodruff 7ab1e2e93d CI: Download and run self-contained datadog-ci instead of using pnpm dlx or npx (#92546)
`pnpm dlx` isn't using a lockfile. Using the self-contained binary from
GitHub and validate the checksum lets us effectively pin `datadog-ci`
and all of its possible transitive dependencies.

This is a follow-up for
https://vercel.slack.com/archives/C0APPN2LC83/p1775073127894859

(cherry picked from commit 631fae951d)
2026-04-27 15:57:18 -07:00
Zack Tanner 084f2bcf19 [ci]: trigger signed release commit via API (#93285)
Stacked on https://github.com/vercel/next.js/pull/93245

Commit signing is required for anything that lands on `canary`. Our
previous workflow of using a PAT to push a commit no longer works, since
that would have been an unsigned commit.

In #93245 we switched to an app token for release workflow steps. This
continues by:

- Telling Lerna to bump packages but not commit
- Creating a signed commit with the staged changes via GitHub's API
- Then running the publish flow

Test Plan:
Dry run
[here](https://github.com/vercel/next.js/actions/runs/25001287978/job/73211826479)
Commit
[here](https://github.com/vercel/next.js/commit/3a8456a62b56615e2f8c1d1e6e7b4e14ce89e078)

(cherry picked from commit 012fd7df4b)
2026-04-27 14:48:10 -07:00
Zack Tanner a3bb370b00 [ci]: app-based release workflow (#93245)
Moves all release workflows off of a GH PAT and uses an app with a
short-lived token instead.

Test Plan:
Dry run
[here](https://github.com/vercel/next.js/actions/runs/24934593874).

However, this workflow is blocked until we figure out commit signing for
the bot app. Some options:
- The bot account generates a signing key and we use it in CI (not
great, bypasses the app)
- The org bypasses signature verification for the bot user (also not
great, requires an exemption rule)
- We need to rework the commit step so Lerna does not do the push, and
instead trigger it via the app + GH API. This seems like the best
option, will be added in a follow-up PR.

Note: `create-release-branch` workflow is broken in its current form, as
we will not be restoring administrator privileges to adjust environment
settings. This will become a manual step in the future.

(cherry picked from commit e69de2ffaf)
2026-04-27 14:48:05 -07:00
Zack Tanner 6e23383c56 [ci]: add environment to publishRelease flow (#93093)
Moves the `environment` into `publishRelease` rather than
`trigger_release` since the actual action we want to create environment
rules for is the publish step.

(cherry picked from commit 2b846de4c5)
2026-04-27 14:47:40 -07:00
Zack Tanner f40b8876e6 [ci]: remove publish token in favor of OIDC (#93065)
Switches from a long-lived token to trusted publishing OIDC flow. This requires a bump to Node (for feature support). Otherwise just dropping unnecessary envs.

(cherry picked from commit 129896c2e4)
2026-04-27 14:47:03 -07:00
JJ Kasper f6bda26ef9 Fix fallback route params case in app-page handler (#93109)
## Summary
- backport the fallback route params fix from #91737 onto `next-16-2`
- preserve intermediate shells that suspend only for unresolved fallback
params during staged rendering
- add the missing `resolvedRouteParamKeys` request metadata needed by
this branch
2026-04-27 12:28:09 -07:00
Zack Tanner 70defda2a8 [ci]: switch to GitHub runners (#93164)
Switch CI from self-hosted runners to GitHub-hosted runners and fix the
follow-up issues that showed up once the hosted jobs were exercised.

- Move Linux workflows onto `ubuntu-latest-16-core-oss`, Windows
workflows onto `windows-latest-8-core-oss`, and the native mac release
lane onto `macos-15-intel`.
- Update the reusable build workflow to work in hosted environments by
relying on `runner.os` instead of label string matching, and by removing
the hardcoded `/home/runner` `fnm` path.
- Make Turbo/sccache configuration explicit for hosted runners:
  - unify on `vtest314-next-adapter-e2e-tests`
- pass `TURBO_TOKEN` via workflow env/secrets instead of assuming
runner-level env
- switch Turbo cache mode to `local:rw,remote:rw` so jobs still have
local cache behavior when remote cache is unavailable
- Update the `sccache` action defaults/docs to use the hosted-runner
secret setup (`TURBO_TOKEN`) instead of the old self-hosted token
wiring.
- Make Datadog reporting fail open so missing `DATA_DOG_API_KEY` does
not block CI.
- Fix the CLI reserved-port test so it asserts Next’s own `-p 1`
validation instead of failing earlier on hosted Linux due to
privileged-port binding.
- Replace the live `musl.cc` dependency in `native-builder.Dockerfile`
with musl sysroots imported from GHCR-hosted `rust-musl-cross` images,
keeping the existing `/opt/*-cross` layout used by the Linux native
build scripts.
- Fix the macOS native build workaround s so it applies to all
*-apple-darwin targets based on the Cargo target OS rather than the host
architecture, which avoids napi-build injecting the unsupported -Wl
linker arg when @next/swc is linked with rust-lld on hosted mac runners.

Test Plan:
- This PR's CI
- This
[build_and_deploy](https://github.com/vercel/next.js/actions/runs/24865715983/job/72801225722)
job running on every arch
2026-04-24 12:14:05 -07:00
Zack Tanner af0e96ba23 Fix invalid HTML response for route-level RSC requests in deployment adapter (#91541)
In a deployed environment, `onCacheEntryV2` determines whether a
postponed response is HTML-origin or RSC-origin by checking whether
meta.url ends with `.rsc`.

For some dynamic full-route RSC requests, Next was passing a URL with
query params into onCacheEntry, for example:
`/[tenant]/samples.rsc?nxtPtenant=tenant-x`

Because that string does not end with .rsc, `onCacheEntryV2`
misclassified the request as HTML and treated it as text/html instead of
an RSC response.

This PR normalizes the URL before passing it to `onCacheEntry`, so the
callback receives the pathname rather than the full URL-with-query.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2026-04-24 06:18:16 -07:00
Zack Tanner 2cdb7ed34f [tests]: fix cache-components.test.ts type error (#93113)
Fixes a type error on canary after merging two PRs that touched the same
test.
2026-04-21 18:29:42 -07:00
JJ Kasper 8cd3fdc111 test: scope css data-url typing to fixture (#91877)
In the latest TypeScript version these imports now fail so updating the
assertion to handle them

x-ref:
https://github.com/vercel/next.js/actions/runs/23508766037/job/68431989897#step:35:443
2026-04-21 18:28:36 -07:00
JJ Kasper 6fd09bf8ab Patch setHeader for direct route handlers (#93101)
## Summary
- apply the `setHeader` cookie-support patch to direct route module
handlers in `prepare()`
- make `patchSetHeaderWithCookieSupport()` idempotent so both entry
paths can call it safely
- add an adapter-like direct RSC regression test that fails without the
patch

Closes: NEXT-4919

## Testing
- `NEXT_SKIP_ISOLATE=1 NEXT_TEST_MODE=start pnpm testheadless
test/e2e/app-dir/cache-components/cache-components.test.ts -t "should
ignore late setHeader calls for direct RSC handlers after headers are
sent"`

<!-- NEXT_JS_LLM_PR -->
2026-04-21 16:46:27 -07:00
Zack Tanner 688ed31e21 Strengthen _rsc cache-busting param (#92755)
This updates `_rsc` cache-busting param generation to use a stronger
digest so different RSC request variants are much less likely to produce
the same value.

It also updates the related request-validation and injected
resume/instant-test paths so they continue to generate and validate the
same `_rsc` values across client, server, and edge-reachable codepaths.
2026-04-21 16:46:26 -07:00
Steven 62ef305096 fix(next/image): ensure images.maximumResponseBody applies to local images too (#92920)
In a previous PR https://github.com/vercel/next.js/pull/88183, we added
`images.maximumResponseBody` but in only applied to external images.

This PR ensures the same config also applies to internal images.
2026-04-21 16:46:21 -07:00
JJ Kasper 15341fdf49 Ensure x-nextjs-data header is only set during resolve (#92752)
Makes sure we set this header during route resolving so user request
doesn't need to.
2026-04-21 13:53:59 -07:00
nextjs-bot 2275bd8598 v16.2.4 v16.2.4 2026-04-15 22:17:07 +00:00