- 30 Jan, 2026 31 commits
-
-
nextjs-bot authored
-
Hendrik Liebau authored
[flakiness metric](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40git.repository.id%3A%22github.com%2Fvercel%2Fnext.js%22%20%40test.name%3A%22browser-log-forwarding%20verbose%20level%20should%20forward%20all%20logs%20to%20terminal%22%20%40test.type%3A%22nextjs%22%20%40test.status%3Afail&agg_m=count&agg_m_source=base&agg_t=count&fromUser=false&index=citest&start=1769207121512&end=1769811921512&paused=false) The test frequently failed because it snapshot-asserted on the forwarded browser logs before the final debug message was forwarded. This is because the initial assertion inside the `retry` block would pass because it falsely matched the debug message inside the error code frame (line 11): ``` [browser] browser error: this is an error message at Page.useEffect (app/page.tsx:10:13) 8 | console.info('browser info: this is an info message') 9 | console.warn('browser warn: this is a warning message') > 10 | console.error('browser error: this is an error message') | ^ 11 | console.debug('browser debug: this is a debug message') 12 | }, []) 13 | (app/page.tsx:10:13) ``` By adding the `[browser] ` prefix to all expected log messages, we ensure that the test only passes when the actual log messages are forwarded, and not when they appear inside code frames. <!-- 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 # -->
-
Hendrik Liebau authored
The server actions transform, which handles the `'use cache'` directive, was not being applied to `node_modules` when imported from route handlers. This caused `'use cache'` functions from dependencies to fail with errors like `"cacheLife() can only be called inside a 'use cache' function"``. The issue was that the `AppRoute` context used `internal_custom_rules` for its foreign code module options, which did not include the server actions transform. This is inconsistent with `AppRSC` (App Router pages), which correctly uses `foreign_next_server_rules` that includes the transform. The fix extends `foreign_next_server_rules` with `internal_custom_rules` and uses it for the foreign code context in `AppRoute`, matching the pattern used by `AppRSC`.
-
nextjs-bot authored
-
Niklas Mischkulnig authored
`test/e2e/middleware-redirects` has 404s on the data route
-
JJ Kasper authored
This test is also very flakey so adds it to the manifest as well
-
nextjs-bot authored
-
Luke Sandberg authored
Improve consistency of how Flag typed fields are handled in the macro to more structurally prevent bugs like what was fixed in #89228 (#89255) # Fix inconsistencies in flag handling ## What? This PR refactors the task flags bitfield implementation to properly separate flags by category (meta vs data) during serialization and deserialization. It also regularizes the way accessors are generated to try to prevent future bugs like what was fixed in #89228
-
Vercel Release Bot authored
This auto-generated PR updates the production integration test manifest used when testing Rspack.
-
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Rspack.
-
Neha Prasad authored
- What? Fixes zlib memory leak in Node.js 24 when requests are aborted. - Why? Compression streams weren't cleaned up on abort, causing memory to accumulate. - How? Destroy the response on request abort/close to clean up compression streams. Closes NEXT- fixes: #89091
-
nextjs-bot authored
-
Andrew Clark authored
## Summary - Adds `experimental.varyParams` feature flag (defaults to `false`) - When disabled, the client skips vary params rekeying and treats params as unknown - Allows internal rollout with easy revert if regressions occur during dogfooding The flag only gates the client-side rekeying logic in `cache.ts`. Server-side param tracking continues regardless. ## Test plan - Enabled the flag in the vary-params and optimistic-routing test fixtures
-
Tobias Koppers authored
### What? This PR adds support for the `type` option in Turbopack rules, enabling users to set the module type directly without requiring a custom loader. This mirrors webpack's [`type`](https://webpack.js.org/configuration/module/#ruletype) option (e.g., `type: 'asset/resource'`). Users can now configure how files are processed by setting the module type directly: ```js // next.config.js module.exports = { turbopack: { rules: { '*.svg': { type: 'asset', }, }, }, } ``` When using type: 'asset', importing the file returns its URL: ``` import svgUrl from './icon.svg' export default function Page() { return <img src={svgUrl} alt="Icon" /> } ``` More types are available. See docs
-
Tobias Koppers authored
### What? * Convert it to a markdown table * Show counts for all meta items * Show size of output
-
JJ Kasper authored
This updates to remove extra tracing that was being done in `build-complete` for deployment adapters to allow importing internal `node-environment` modules. Instead this exposes `next/setup-node-env` to adapters outputs that can be used instead and are traced through our normal bundling/tracing flow.
-
nextjs-bot authored
-
Niklas Mischkulnig authored
Closes PACK-6537 When a deployment id is available, don't put the data routes at `_next/data/<BUILDID>/page.json`, but at `_next/data/page.json`. Deployment skew (forcing a MPA nav instead of a SPA nav if a deployment happened inbetween) is handled by comparing a header on the client side. If you use `output:export` and set `config.deploymentId` (i.e. enable skew protection) you are still expected to set these headers. --- - [x] Find the right place where the header should be added for prerendered static RSC responses (route manifest)
-
Sebastian "Sebbie" Silbermann authored
-
Jiachi Liu authored
-
nextjs-bot authored
-
Andrew Clark authored
During prerendering, track which route params each segment accesses. Params that are NOT accessed can be omitted from the client router's cache key for that segment, allowing it to be shared across multiple pages and reducing the number of prefetch requests. For example, if a page at /shop/[category]/[itemId] only accesses `category` but not `itemId`, navigating between /shop/electronics/phone and /shop/electronics/tablet can reuse the same cached page segment, since only `category` affects its output. Most of the client-side changes were already implemented in previous PRs; the core mechanism was already being used for omitting search params from the cache keys of static segments. This generalizes the mechanism for all params. So this PR is primarily about adding per-param tracking on the server and wiring up the logic to send the params to the client. Each segment's CacheNodeSeedData contains its own VaryParamsThenable that resolves to a Set<string> of accessed param names. The thenable is a mutable tracker during render that accumulates param accesses, then resolves when rendering completes. The response also includes an `h` field for head vary params, which tracks params accessed by generateMetadata/generateViewport separately from segment body access. The trickiest part of this implementation is the timing. The vary params thenables represent metadata about the response, but they're also part of the response itself - they're streamed alongside the segment data. We can't know which params were accessed until rendering completes, but we need to resolve all thenables before aborting the stream, or else the client would block waiting for data that will never arrive. We address this on both sides. On the server, we resolve all thenables immediately before aborting. On the client, we read vary params synchronously using a React Flight optimization: calling thenable.then(noop) forces Flight to transition from 'resolved_model' to 'fulfilled' without scheduling a microtask. If the thenable still isn't fulfilled after this, we fall back to null (unknown) rather than blocking. This ensures the client never suspends on these thenables, providing a safe fallback if something goes wrong with server timing. A key distinction is null vs empty Set. An empty Set means the segment accesses no params and can be shared across all param values - this is the case for client components (when Cache Components is enabled), segments without user code, etc. A null value means tracking failed - either because it's not wired up yet (like runtime prefetches), or due to some edge case where the thenables weren't resolved in time. For segments where we know upfront that no params will be accessed, we use a singleton emptyVaryParamsTracker that's already resolved. This ensures these segments resolve correctly even if other tracking fails. In the future, we'll likely optimize the response format by sending a bitmask instead of a Set of param names. But this is mostly just an optimization — sending the Set doesn't expose anything new since the param names are already embedded in the route tree (although that's also something we could obfuscate in the future). This does not yet implement vary param tracking during runtime prefetches - the abort timing needs additional coordination. Deferred to a separate PR.
-
Tobias Koppers authored
### What? Stop rules when module type is set. Apply ecmascript transforms before module type is set. (no more errors when trying to apply a transform on non-ecmascript type) Fix ordering of transform apply. Reorder module rules to match previous order. They are applied in order now.
-
Deni Mintsaev authored
-
Sebastian "Sebbie" Silbermann authored
-
Tobias Koppers authored
### What? Add `contentType` condition This allows to apply webpack loaders to data urls ### Usage Example ``` module.exports = { turbopack: { rules: { '*': [ { condition: { contentType: 'text/*' }, // glob match loaders: ['text-loader'], as: '*.js' }, { condition: { contentType: /^image\// }, // regex match loaders: ['image-loader'], as: '*.js' }, ], }, }, } ``` -
Vercel Release Bot authored
Co-authored-by:nextjs-bot <it+nextjs-bot@vercel.com>
-
Tobias Koppers authored
### What? add a feature flag `trace_task_modification` which adds the reason why a task was marked as modified to the tracing
-
Vercel Release Bot authored
This auto-generated PR updates font data with latest available Co-authored-by:nextjs-bot <it+nextjs-bot@vercel.com>
-
jaffar keikei authored
**What changed?** `stringifyUrlQueryParam` now handles `bigint` type properly. **Why?** BigInt is a valid JavaScript primitive but was being converted to empty string: Before: ```js stringifyUrlQueryParam(123n) // ''
❌ ``` After: ```js stringifyUrlQueryParam(123n) // '123' ✓ ``` **Use case:** Query parameters with large integers (IDs, timestamps) often use BigInt to avoid precision loss. **Testing** Manual testing with BigInt values. -
Luke Sandberg authored
Use field annotations to drive what fields get 'shrunk' when a task completes. Doing this also optimizes the implementation since instead of scanning for each field we care about we walk all fields and handle the correct subset as we find them. Also take advantage of some features of immutable tasks (which account for about 25% of all tasks), and more aggressively drop some fields Saves quite a bit of memory and maybe a little bit of time 
-
- 29 Jan, 2026 9 commits
-
-
Bradley Wilson-Hunt authored
This change should unifiy the runAfterProductionCompile output to follow the same style as other times printed in the build logs. Currently build logs look like ``` ✓ Compiled successfully in 89s Running next.config.js provided runAfterProductionCompile ... ✓ Finished writing to filesystem cache in 18.5s ✓ Completed runAfterProductionCompile in 36134ms Skipping validation of types ``` I hope they will now look like ``` ✓ Compiled successfully in 89s Running next.config.js provided runAfterProductionCompile ... ✓ Finished writing to filesystem cache in 18.5s ✓ Completed runAfterProductionCompile in 36.1s Skipping validation of types ``` (and yes i know 36s is shameful thats my next problem but this irked me enough to want the build output looking nicer ahhaha) It feels like adding a test for this would be semi counter productive without basically ending up adding sleeps and then in reality its testing more the logic of `durationToStringWithNanoseconds`.
-
jaffar keikei authored
## Summary This PR fixes ~two~ one bug~s~ in the `isCsrfOriginAllowed` function used for Server Actions CSRF protection: 1. **Case sensitivity bug**: Domain matching was case-sensitive, but DNS names are case-insensitive per [RFC 1035](https://datatracker.ietf.org/doc/html/rfc1035#section-2.3.3). This caused legitimate requests to fail CSRF checks when the Origin header contained uppercase characters. 2. ~**Trailing dot bug**: FQDNs with trailing dots (e.g., `example.com.`) weren't matched. The trailing dot is valid DNS notation representing the root zone.~ Edit: Reverted, see comments on PR ## The Problem Before this fix: ```javascript isCsrfOriginAllowed('sub.VERCEL.com', ['*.vercel.com']) // false
❌ isCsrfOriginAllowed('sub.vercel.com.', ['*.vercel.com']) // false❌ ``` Both of these should return `true` because: - DNS is case-insensitive (RFC 1035 §2.3.3) - Trailing dots are valid FQDN notation ## The Fix Normalize both domain and pattern before comparison: - Convert to lowercase - Strip trailing dots ## Testing Added new test cases for: - Case-insensitive matching (various case combinations) - Trailing dot handling (in both domain and pattern) All existing tests continue to pass. ## Related - This affects users who configure `serverActions.allowedOrigins` in `next.config.js` - The bug could cause legitimate Server Action requests to be rejected with CSRF errors if the browser sends an Origin header with different casing than the configured pattern -
Jiwon Choi authored
This deployment test has been failing very recently. This PR adds the test case to the deployment test manifest to unblock sync. Will continue deflaking at this PR at https://github.com/vercel/next.js/pull/89187 x-ref: [Datadog](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40ci.pipeline.name%3Atest-e2e-deploy-release%20%40ci.pipeline.url%3A%2A%2Fattempts%2F2%20%40test.status%3Afail&agg_m=count&agg_m_source=base&agg_q=%40test.name&agg_q_source=base&agg_t=count¤tTab=history&eventStack=&fromUser=true&index=citest&panel=%7B%22queryString%22%3A%22%40test.name%3A%5C%22resume-data-cache%20should%20have%20consistent%20data%20between%20static%20and%20dynamic%20renders%20with%20fetch%20cache%5C%22%22%2C%22filters%22%3A%5B%7B%22isClicked%22%3Atrue%2C%22source%22%3A%22log%22%2C%22path%22%3A%22test.name%22%2C%22value%22%3A%22resume-data-cache%20should%20have%20consistent%20data%20between%20static%20and%20dynamic%20renders%20with%20fetch%20cache%22%7D%5D%2C%22timeRange%22%3A%7B%22from%22%3A1769520224000%2C%22to%22%3A1769693024000%2C%22live%22%3Atrue%7D%7D&test-detail-history=log_test.status%2Ctimestamp%2Clog_git.branch%2Clog_git.commit.sha%2Clog_test.is_known_flaky&top_n=30&top_o=top&viz=query_table&x_missing=true&start=1769520224360&end=1769693024360&paused=false) Part of https://linear.app/vercel/issue/NAR-719/fix-deploy-tests
-
Jiwon Choi authored
This deployment test has been failing very recently since the first attempt of [v16.1.5](https://github.com/vercel/next.js/actions/runs/21373599266/attempts/2). Tried deflaking at https://github.com/vercel/next.js/pull/87412, but seems to have no effect. This PR adds the test case to the deployment test manifest to unblock sync. Will continue deflaking at this PR at https://github.com/vercel/next.js/pull/89106 x-ref: [Datadog](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40ci.pipeline.name%3Atest-e2e-deploy-release%20%40ci.pipeline.url%3A%2A%2Fattempts%2F2%20%40test.status%3Afail&agg_m=count&agg_m_source=base&agg_q=%40test.name&agg_q_source=base&agg_t=count¤tTab=overview&eventStack=&fromUser=true&index=citest&panel=%7B%22queryString%22%3A%22%40test.name%3A%5C%22app%20dir%20client%20cache%20semantics%20%28default%20semantics%29%20prefetch%3D%7Bundefined%7D%20-%20default%20should%20refetch%20the%20full%20page%20after%205%20mins%5C%22%22%2C%22filters%22%3A%5B%7B%22isClicked%22%3Atrue%2C%22source%22%3A%22log%22%2C%22path%22%3A%22test.name%22%2C%22value%22%3A%22app%20dir%20client%20cache%20semantics%20%28default%20semantics%29%20prefetch%3D%7Bundefined%7D%20-%20default%20should%20refetch%20the%20full%20page%20after%205%20mins%22%7D%5D%2C%22timeRange%22%3A%7B%22from%22%3A1769209200000%2C%22to%22%3A1769514811691%2C%22live%22%3Afalse%7D%7D&test-detail-history=log_test.status%2Ctimestamp%2Clog_git.branch%2Clog_git.commit.sha%2Clog_test.is_known_flaky&top_n=30&top_o=top&viz=query_table&x_missing=true&start=1769209200000&end=1769514811691&paused=true) x-ref: [slack thread](https://vercel.slack.com/archives/C02CDC2ALJH/p1769519877570459) Part of https://linear.app/vercel/issue/NAR-719/fix-deploy-tests
-
Alex Carpenter authored
### What Switches the `create-next-app` templates (`app-tw`, `app`) to flex-based layouts instead of `min-height: 100vh`. ### Why At Clerk, we ship a template on top of `create-next-app` that adds a header with sign-in/sign-up links to the root layout. The current `min-height: 100vh` approach causes overflow as soon as you add anything to the layout. Here's a [minimal repo showing the overflow issue](https://github.com/alexcarpenter/nextjs-layout-template-repo). Using flexbox lets the page fill remaining space naturally, so headers/footers don't force an overflow and avoids us having to modify the `page.tsx` template. ### Changes **Tailwind (`app-tw`):** - Layout: `h-full` on `<html>`, `min-h-full flex flex-col` on `<body>` - Page: `min-h-screen` → `flex flex-col flex-1` **CSS Modules (`app`):** - `globals.css`: `height: 100%` on html, `min-height: 100%; display: flex; flex-direction: column` on body - `page.module.css`: `min-height: 100vh` → `flex: 1` The empty templates (`app-empty`, `app-tw-empty`) don't have height styling so they're unchanged. | BEFORE | AFTER | |--------|--------| | <img width="1392" height="1522" alt="Screenshot 2026-01-29 at 9 41 58 AM" src="https://github.com/user-attachments/assets/6642de41-253b-42c0-af2d-d55c4e651541" /> | <img width="1392" height="1522" alt="Screenshot 2026-01-29 at 9 42 31 AM" src="https://github.com/user-attachments/assets/633f3d46-ed8c-4d05-8173-77f2cf166703" /> | Closes NEXT- Fixes #
-
nextjs-bot authored
-
Zack Tanner authored
This restores fast navigations to fully static PPR routes in Cache Components, even when prefetch hasn’t completed or `prefetch={false}` is used. In legacy versions of PPR, the `prefetchDataRoute` entries would be populated with `.prefetch.rsc` values containing static RSC payloads. This regressed in cache components, and the only static RSC payloads were in the `.segments` directory. However, when Next.js triggers a regular RSC request (non-prefetch), either because the prefetch hadn't completed yet or `prefetch={false}` was configured, we'd route to the empty fallback and trigger a function invocation. This restores old behavior of emitting a `.rsc` file for a fully static route. This information technically also exists in the `.segments` directory, but it's split into parts, and it's now routed to unless explicitly done so via the `next-router-segment-prefetch` header. In addition to emitting the route, this also ensures we set `prefetchDataRoute` to point to this. This is how the Vercel adapter knows the file to serve. An e2e regression test now asserts that `prefetch={false}` navigation does not wait for a dynamic render. The deploy test will be unblocked once https://github.com/vercel/vercel/pull/14770 lands. -
Niklas Mischkulnig authored
Needed for https://github.com/vercel/vercel/pull/14795 Keep the file so that we can instead dynamically render it as opposed to having to bundle the prerender into the function
-
Andrew Clark authored
Based on: - https://github.com/vercel/next.js/pull/88834 - https://github.com/vercel/next.js/pull/88989 - https://github.com/vercel/next.js/pull/88998 --- Adds optimistic routing, enabling the client to predict route structure for URLs that haven't been prefetched yet. When navigating to a URL like /blog/post-2, if we've previously learned the pattern from /blog/post-1, we can predict the route structure without waiting for a server response. The client learns route patterns from server responses and builds a trie indexed by URL parts. When a cache miss occurs, we check if the URL matches a known pattern. If so, we create a synthetic cache entry from the template, allowing immediate rendering of loading boundaries. Static siblings (like /blog/featured alongside /blog/[slug]) are tracked to avoid incorrect predictions — we only predict dynamic routes when we're confident no static sibling matches.
-