Repository navigation
Name the third-party package in sync IO prerender errors - #102471
Draft
aurorascharff wants to merge 5 commits into
Draft
aurorascharff wants to merge 5 commits into
aurorascharff wants to merge 5 commits into
Conversation
Contributor
Tests PassedCommit: b1a50ac |
aurorascharff
force-pushed
the
aurora/sync-io-third-party-package
branch
from
November 27, 2026 10:43
d8311c5 to
5035653
Compare
aurorascharff
changed the base branch from
canary
to
codex/suggest-browser-for-sync-io
November 27, 2026 10:44
This was referenced Nov 27, 2026
aurorascharff
force-pushed
the
aurora/sync-io-third-party-package
branch
from
November 27, 2026 10:53
5035653 to
5275c96
Compare
aurorascharff
force-pushed
the
aurora/sync-io-third-party-package
branch
2 times, most recently
from
November 27, 2026 11:02
f408331 to
c08a3bd
Compare
aurorascharff
force-pushed
the
aurora/sync-io-third-party-package
branch
from
November 27, 2026 11:05
c08a3bd to
ae431c9
Compare
aurorascharff
force-pushed
the
aurora/sync-io-third-party-package
branch
from
November 27, 2026 11:11
ae431c9 to
d903838
Compare
aurorascharff
force-pushed
the
aurora/sync-io-third-party-package
branch
from
November 27, 2026 11:13
d903838 to
d0cf1a1
Compare
aurorascharff
force-pushed
the
aurora/sync-io-third-party-package
branch
from
November 27, 2026 11:20
d0cf1a1 to
39ce52a
Compare
aurorascharff
force-pushed
the
aurora/sync-io-third-party-package
branch
from
November 27, 2026 13:33
39ce52a to
3b825b1
Compare
aurorascharff
force-pushed
the
aurora/sync-io-third-party-package
branch
from
November 27, 2026 13:43
3b825b1 to
df106ae
Compare
aurorascharff
added a commit
that referenced
this pull request
Nov 27, 2026
) ## Summary Correct the sync IO guidance across the Cache Components migration guide, the six error pages, and the `connection()` reference. Build on the browser-only rendering guidance merged in #102401: lead with `use(browser())` for browser-only library rendering, distinguish module imports and lazy loading, and link to the SPA guide for those details. Server examples suspend before a fresh read with `await io()` under a parent Suspense boundary, retain `connection()` as an alternative, and show caching for reusable values. The three Client Component pages first show where to wrap the component in `<Suspense>`. For values that client code also needs, pass the server value as a prop so hydration reuses it. The migration guide makes the same server/client distinction. When a package is named, #102471 links to the external-library section on the matching error page. Each section distinguishes the library calls or inputs that can be cached on the server from reads that must be fresh or happen during client rendering. The two clock errors also link directly to the existing TanStack Query guide: [cache the hydration timestamp on the server](https://github.com/vercel/next.js/blob/canary/docs/01-app/02-guides/client-side-data-fetching/tanstack-query.mdx#build-a-prerenderable-hydration-state) or [wrap the query component in Suspense on the client](https://github.com/vercel/next.js/blob/canary/docs/01-app/02-guides/client-side-data-fetching/tanstack-query.mdx#use-suspense-for-client-data). The request ID label stays in the shell while only its value loads. Clarify that a driver can read time or randomness before its async query suspends, and that request APIs may resolve during runtime prerendering with Partial Prefetching. Separate data generation and timing instrumentation from component rendering so the examples pass React's purity rule. ## Verification - Parsed all 105 JS/TS snippets across the eight changed pages. All 92 JSX/TSX snippets pass React's purity, set-state-in-effect, and refs rules. - Prettier and MDX ESLint pass. The CI link checker's read-only validation passes for 317 internal links across the eight pages. All 17 overlay fix cards match their error pages in order, wording, snippets, and links. - [Runnable reproductions](aurorascharff/reproductions#3) and [hosted production build and browser checks](https://github.com/aurorascharff/reproductions/actions/runs/45258382066) on Next.js 16.4.6 previously verified server fixes, session prefetch after request data, and hydration. Recomputing a timestamp in a request-time Client Component produced React #418; serialized server props and post-mount reads hydrated cleanly. The latest documentation edits have not had a new browser run. <!-- NEXT_JS_LLM -->
aurorascharff
force-pushed
the
aurora/sync-io-third-party-package
branch
2 times, most recently
from
November 27, 2026 13:54
3e04979 to
74d2aca
Compare
aurorascharff
force-pushed
the
aurora/sync-io-third-party-package
branch
from
November 27, 2026 14:08
74d2aca to
1b5cbc0
Compare
aurorascharff
changed the base branch from
codex/suggest-browser-for-sync-io
to
canary
November 27, 2026 14:08
<!-- NEXT_JS_LLM -->
aurorascharff
force-pushed
the
aurora/sync-io-third-party-package
branch
from
November 27, 2026 14:20
1b5cbc0 to
f363772
Compare
aurorascharff
changed the base branch from
canary
to
codex/suggest-browser-for-sync-io
November 27, 2026 14:20
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a dependency reads the clock,
Math.random(), or a sync crypto API during prerendering, the error now names that package. It doesn't add any dependency stack frames.Stacked on #99677. When a package is named, “Learn more” links to the external-library section on the matching error page. That section points to the applicable fixes; each card still links directly to its own recipe. The sections landed in #102245 (for example, current time in an external library).
Why
The dependency's frames are ignore-listed, so the error either blames the app component that rendered it or collapses to
at ignore-listed frames. That happens with the defaultnext build. The developer can't tell which library made the read or where in their app to apply the fix. Reports include carousel React wrappers that create their instance during render, andpgcallingcrypto.getRandomValues().Before (Turbopack, default
next build):After:
The dev overlay title doesn't change. The package appears after the explanation in the same paragraph: "The call comes from the
external-timepackage." The existing "Learn more" link points to the external-library subsection on the relevant error page, matching the terminal output.Approach
This replaces #102189 and #102292. Ignore-listing and stack ordering are unchanged everywhere, so the top frame stays in code the user owns, which is where the fix goes. Only the package name is added, as one sentence after the explanation, so no frames push user code down the stack. It shows up the same way in the default build,
--debug-prerender, the terminal, and the overlay.patch-error-inspectgetsfindThirdPartyPackageInStack(). It source-maps the frames the same way error printing does, skips framework frames, and returns the package of the first ignore-listed frame insidenode_modules. If it reaches a frame the user owns first, it returnsnull, so reads in app code are unchanged. It is shared viaglobalThis(like the code frame renderer) and only installed when source maps are enabled.io()asks for the caller when it creates a sync IO error (prerender, client prerender, and dev validation stages). Attribution is best-effort and can't mask the actual error.getThirdPartyPackageName()uses the innermostnode_modulessegment. That handles scoped packages and pnpm's virtual store. It excludes Next.js, React,scheduler,styled-jsx,@swc/helpers,@next/*, and anything installed insidenext.#when-the-read-comes-from-an-external-libraryon the relevant error page. Those sections are provided by Docs: clarify prerender errors for time, randomness, and crypto #102245.Limitation: with Webpack, server source maps exist only with
--debug-prerenderorexperimental.serverSourceMaps. Without them, a bundled dependency can't be told apart from app code, so the message stays unchanged. Packages inserverExternalPackagesare named either way.Validation
On top of #99677, the attribution patch has the same added and removed lines as the standalone version. All 202 focused package, overlay, and guidance unit tests passed, and all 17 cards match the six error pages. The stack merges cleanly with
canary, including all six external-library anchors. At the time of the restack, those sections were not yet live on nextjs.org. Full build and browser suites were not rerun for this restack.Validation before this update:
New e2e suite
test/e2e/app-dir/sync-io-third-party-packagecovers a bundled server dependency reading the clock, aserverExternalPackagesdependency callingcrypto.getRandomValues(), a dependency rendered from a Client Component, and a control where app code readsnew Date()and no package is named.pnpm test-start-turbo: 8/8, with and without--debug-prerenderpnpm test-start-webpack: 8/8, including the source-map limitation abovepnpm test-dev-turbo: 4/4 (redbox)pnpm test-dev-webpack: 4/4 (redbox)third-party-package.test.ts(path parsing) anderrors.test.ts(overlay classification): 172 passedtest/production/next-server-nft: snapshot updated for the newserver/lib/third-party-package.js, 6/6pnpm --filter=next types, ESLint, and Prettier passScreenshots