Unverified Commit b8c7c7f2 authored by Aurora Scharff's avatar Aurora Scharff Committed by GitHub

Improve static route error guidance (#99724)

## Summary

- explain that request-time work conflicts with the route's static
requirement without repeating “fully static”
- align the overlay explanations, build messages, and error pages for
route body, `generateMetadata()`, and `generateViewport()` errors
- replace the cookie-specific runtime-data card with short browser-data
pseudocode while preserving its existing docs anchor
- update the affected build-output snapshots

## Verification

- `pnpm jest
packages/next/src/next-devtools/dev-overlay/components/instant/instant-guidance-data.test.ts`
- formatted and linted all changed source, test, and MDX files
- Not run: full package build (the isolated worktree reused an older
dependency install that does not include the latest
`@base-ui-components/react` packages)

<!-- NEXT_JS_LLM -->
parent 81bdd9cb
...@@ -22,7 +22,7 @@ kind: error ...@@ -22,7 +22,7 @@ kind: error
A page or layout on this route exports [`ensureStatic`](/docs/app/api-reference/file-conventions/route-segment-config/ensureStatic) with the `'navigation'` value, requiring all server-rendered work for the route to complete during prerendering. A page or layout on this route exports [`ensureStatic`](/docs/app/api-reference/file-conventions/route-segment-config/ensureStatic) with the `'navigation'` value, requiring all server-rendered work for the route to complete during prerendering.
During [prerendering](/docs/app/glossary#prerendering), [`generateMetadata()`](/docs/app/api-reference/functions/generate-metadata) performed an uncached [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) request, database call, or [`connection()`](/docs/app/api-reference/functions/connection). The operation requires request-time server work and prevents `generateMetadata()` from being fully prerendered. During [prerendering](/docs/app/glossary#prerendering), [`generateMetadata()`](/docs/app/api-reference/functions/generate-metadata) performed an uncached [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) request, database call, or [`connection()`](/docs/app/api-reference/functions/connection). The operation requires rendering at request time, which conflicts with the route's static requirement.
During `next build`, Next.js may link to this page when it cannot distinguish uncached data from runtime data. For a short cache, [extend the cache lifetime](/docs/messages/static-metadata-runtime#extend-the-cache-lifetime). During `next build`, Next.js may link to this page when it cannot distinguish uncached data from runtime data. For a short cache, [extend the cache lifetime](/docs/messages/static-metadata-runtime#extend-the-cache-lifetime).
...@@ -113,7 +113,7 @@ The metadata is determined during prerendering rather than from the removed data ...@@ -113,7 +113,7 @@ The metadata is determined during prerendering rather than from the removed data
## Verifying the fix ## Verifying the fix
After applying a fix, rerun [`next build`](/docs/app/api-reference/cli/next#next-build-options) and confirm that the route completes prerendering. If the error also appeared in [`next dev`](/docs/app/api-reference/cli/next#next-dev-options), reload the route and confirm that the overlay clears. Wrapping the operation in Suspense or setting `instant = false` does not relax the fully static requirement. After applying a fix, rerun [`next build`](/docs/app/api-reference/cli/next#next-build-options) and confirm that the route completes prerendering. If the error also appeared in [`next dev`](/docs/app/api-reference/cli/next#next-dev-options), reload the route and confirm that the overlay clears. Wrapping the operation in Suspense or setting `instant = false` does not relax this static requirement.
In `next dev`, the error overlay points at the failing function with file paths and line numbers. Run [`next build --debug-prerender`](/docs/app/guides/building#debug-prerender-errors) for full user-frame stack traces and `next build --debug-build-paths /dashboard /settings` to iterate on specific routes. In `next dev`, the error overlay points at the failing function with file paths and line numbers. Run [`next build --debug-prerender`](/docs/app/guides/building#debug-prerender-errors) for full user-frame stack traces and `next build --debug-build-paths /dashboard /settings` to iterate on specific routes.
......
...@@ -22,7 +22,7 @@ kind: error ...@@ -22,7 +22,7 @@ kind: error
A page or layout on this route exports [`ensureStatic`](/docs/app/api-reference/file-conventions/route-segment-config/ensureStatic) with the `'navigation'` value, requiring all server-rendered work for the route to complete during prerendering. A page or layout on this route exports [`ensureStatic`](/docs/app/api-reference/file-conventions/route-segment-config/ensureStatic) with the `'navigation'` value, requiring all server-rendered work for the route to complete during prerendering.
During [prerendering](/docs/app/glossary#prerendering), [`generateMetadata()`](/docs/app/api-reference/functions/generate-metadata) read request-specific data from [`cookies()`](/docs/app/api-reference/functions/cookies), [`headers()`](/docs/app/api-reference/functions/headers), [`params`](/docs/app/api-reference/file-conventions/page#params-optional), or [`searchParams`](/docs/app/api-reference/file-conventions/page#searchparams-optional). These values are only available for a request and prevent `generateMetadata()` from being fully prerendered. During [prerendering](/docs/app/glossary#prerendering), [`generateMetadata()`](/docs/app/api-reference/functions/generate-metadata) read request-specific data from [`cookies()`](/docs/app/api-reference/functions/cookies), [`headers()`](/docs/app/api-reference/functions/headers), [`params`](/docs/app/api-reference/file-conventions/page#params-optional), or [`searchParams`](/docs/app/api-reference/file-conventions/page#searchparams-optional). Reading these values in `generateMetadata()` requires rendering at request time, which conflicts with the route's static requirement.
A [`use cache`](/docs/app/api-reference/directives/use-cache) scope also triggers this error when its [`expire`](/docs/app/api-reference/functions/cacheLife#expire) is under five minutes, [`stale`](/docs/app/api-reference/functions/cacheLife#stale) is under 30 seconds, or [`revalidate`](/docs/app/api-reference/functions/cacheLife#revalidate) is `0`. A [`use cache`](/docs/app/api-reference/directives/use-cache) scope also triggers this error when its [`expire`](/docs/app/api-reference/functions/cacheLife#expire) is under five minutes, [`stale`](/docs/app/api-reference/functions/cacheLife#stale) is under 30 seconds, or [`revalidate`](/docs/app/api-reference/functions/cacheLife#revalidate) is `0`.
...@@ -82,7 +82,7 @@ Learn more: [`cacheLife`](/docs/app/api-reference/functions/cacheLife). ...@@ -82,7 +82,7 @@ Learn more: [`cacheLife`](/docs/app/api-reference/functions/cacheLife).
## Verifying the fix ## Verifying the fix
After applying a fix, rerun [`next build`](/docs/app/api-reference/cli/next#next-build-options) and confirm that the route completes prerendering. If the error also appeared in [`next dev`](/docs/app/api-reference/cli/next#next-dev-options), reload the route and confirm that the overlay clears. Wrapping the access in Suspense or setting `instant = false` does not relax the fully static requirement. After applying a fix, rerun [`next build`](/docs/app/api-reference/cli/next#next-build-options) and confirm that the route completes prerendering. If the error also appeared in [`next dev`](/docs/app/api-reference/cli/next#next-dev-options), reload the route and confirm that the overlay clears. Wrapping the access in Suspense or setting `instant = false` does not relax this static requirement.
In `next dev`, the error overlay points at the failing function with file paths and line numbers. Run [`next build --debug-prerender`](/docs/app/guides/building#debug-prerender-errors) for full user-frame stack traces and `next build --debug-build-paths /dashboard /settings` to iterate on specific routes. In `next dev`, the error overlay points at the failing function with file paths and line numbers. Run [`next build --debug-prerender`](/docs/app/guides/building#debug-prerender-errors) for full user-frame stack traces and `next build --debug-build-paths /dashboard /settings` to iterate on specific routes.
......
...@@ -22,7 +22,7 @@ kind: error ...@@ -22,7 +22,7 @@ kind: error
A page or layout on this route exports [`ensureStatic`](/docs/app/api-reference/file-conventions/route-segment-config/ensureStatic) with the `'navigation'` value, requiring all server-rendered work for the route to complete during prerendering. A page or layout on this route exports [`ensureStatic`](/docs/app/api-reference/file-conventions/route-segment-config/ensureStatic) with the `'navigation'` value, requiring all server-rendered work for the route to complete during prerendering.
During [prerendering](/docs/app/glossary#prerendering), the page or layout performed an uncached [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) request, database call, or [`connection()`](/docs/app/api-reference/functions/connection). Because the operation requires request-time server work, the route cannot be fully prerendered. During [prerendering](/docs/app/glossary#prerendering), the page or layout performed an uncached [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) request, database call, or [`connection()`](/docs/app/api-reference/functions/connection). The operation requires rendering at request time, which conflicts with the route's static requirement.
During `next build`, Next.js may link to this page when it cannot distinguish uncached data from runtime data. For a short cache, [extend the cache lifetime](/docs/messages/static-route-runtime#extend-the-cache-lifetime). During `next build`, Next.js may link to this page when it cannot distinguish uncached data from runtime data. For a short cache, [extend the cache lifetime](/docs/messages/static-route-runtime#extend-the-cache-lifetime).
...@@ -166,7 +166,7 @@ The prerender does not include this data, and the browser makes an additional re ...@@ -166,7 +166,7 @@ The prerender does not include this data, and the browser makes an additional re
## Verifying the fix ## Verifying the fix
After applying a fix, rerun [`next build`](/docs/app/api-reference/cli/next#next-build-options) and confirm that the route completes prerendering. If the error also appeared in [`next dev`](/docs/app/api-reference/cli/next#next-dev-options), reload the route and confirm that the overlay clears. Wrapping the operation in Suspense or setting `instant = false` does not relax the fully static requirement. After applying a fix, rerun [`next build`](/docs/app/api-reference/cli/next#next-build-options) and confirm that the route completes prerendering. If the error also appeared in [`next dev`](/docs/app/api-reference/cli/next#next-dev-options), reload the route and confirm that the overlay clears. Wrapping the operation in Suspense or setting `instant = false` does not relax this static requirement.
In `next dev`, the error overlay points at the failing component with file paths and line numbers. Run [`next build --debug-prerender`](/docs/app/guides/building#debug-prerender-errors) for full user-frame stack traces and `next build --debug-build-paths /dashboard /settings` to iterate on specific routes. In `next dev`, the error overlay points at the failing component with file paths and line numbers. Run [`next build --debug-prerender`](/docs/app/guides/building#debug-prerender-errors) for full user-frame stack traces and `next build --debug-build-paths /dashboard /settings` to iterate on specific routes.
......
...@@ -22,7 +22,7 @@ kind: error ...@@ -22,7 +22,7 @@ kind: error
A page or layout on this route exports [`ensureStatic`](/docs/app/api-reference/file-conventions/route-segment-config/ensureStatic) with the `'navigation'` value, requiring all server-rendered work for the route to complete during prerendering. A page or layout on this route exports [`ensureStatic`](/docs/app/api-reference/file-conventions/route-segment-config/ensureStatic) with the `'navigation'` value, requiring all server-rendered work for the route to complete during prerendering.
During [prerendering](/docs/app/glossary#prerendering), the page or layout read request-specific data from [`cookies()`](/docs/app/api-reference/functions/cookies), [`headers()`](/docs/app/api-reference/functions/headers), [`params`](/docs/app/api-reference/file-conventions/page#params-optional), or [`searchParams`](/docs/app/api-reference/file-conventions/page#searchparams-optional). Because these values are only available for a request, the route cannot be fully prerendered. During [prerendering](/docs/app/glossary#prerendering), the page or layout read request-specific data from [`cookies()`](/docs/app/api-reference/functions/cookies), [`headers()`](/docs/app/api-reference/functions/headers), [`params`](/docs/app/api-reference/file-conventions/page#params-optional), or [`searchParams`](/docs/app/api-reference/file-conventions/page#searchparams-optional). Reading these values requires rendering at request time, which conflicts with the route's static requirement.
A [`use cache`](/docs/app/api-reference/directives/use-cache) scope also triggers this error when its [`expire`](/docs/app/api-reference/functions/cacheLife#expire) is under five minutes, [`stale`](/docs/app/api-reference/functions/cacheLife#stale) is under 30 seconds, or [`revalidate`](/docs/app/api-reference/functions/cacheLife#revalidate) is `0`. A [`use cache`](/docs/app/api-reference/directives/use-cache) scope also triggers this error when its [`expire`](/docs/app/api-reference/functions/cacheLife#expire) is under five minutes, [`stale`](/docs/app/api-reference/functions/cacheLife#stale) is under 30 seconds, or [`revalidate`](/docs/app/api-reference/functions/cacheLife#revalidate) is `0`.
...@@ -47,8 +47,8 @@ Uncached [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/fet ...@@ -47,8 +47,8 @@ Uncached [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/fet
href="#read-the-data-on-the-client" href="#read-the-data-on-the-client"
snippets={[ snippets={[
{ text: "'use client'" }, { text: "'use client'" },
{ text: "use(browser('Read cookie'))", highlight: true }, { text: 'use(browser())', highlight: true },
{ text: 'const cart = document.cookie.match(/cart=(\\d+)/)' }, { text: 'const value = readBrowserData()' },
]} ]}
/> />
</FixCardGrid> </FixCardGrid>
...@@ -141,7 +141,7 @@ Learn more: [`cacheLife`](/docs/app/api-reference/functions/cacheLife). ...@@ -141,7 +141,7 @@ Learn more: [`cacheLife`](/docs/app/api-reference/functions/cacheLife).
## Verifying the fix ## Verifying the fix
After applying a fix, rerun [`next build`](/docs/app/api-reference/cli/next#next-build-options) and confirm that the route completes prerendering. If the error also appeared in [`next dev`](/docs/app/api-reference/cli/next#next-dev-options), reload the route and confirm that the overlay clears. Wrapping the access in Suspense or setting `instant = false` does not relax the fully static requirement. After applying a fix, rerun [`next build`](/docs/app/api-reference/cli/next#next-build-options) and confirm that the route completes prerendering. If the error also appeared in [`next dev`](/docs/app/api-reference/cli/next#next-dev-options), reload the route and confirm that the overlay clears. Wrapping the access in Suspense or setting `instant = false` does not relax this static requirement.
In `next dev`, the error overlay points at the failing component with file paths and line numbers. Run [`next build --debug-prerender`](/docs/app/guides/building#debug-prerender-errors) for full user-frame stack traces and `next build --debug-build-paths /dashboard /settings` to iterate on specific routes. In `next dev`, the error overlay points at the failing component with file paths and line numbers. Run [`next build --debug-prerender`](/docs/app/guides/building#debug-prerender-errors) for full user-frame stack traces and `next build --debug-build-paths /dashboard /settings` to iterate on specific routes.
......
...@@ -22,7 +22,7 @@ kind: error ...@@ -22,7 +22,7 @@ kind: error
A page or layout on this route exports [`ensureStatic`](/docs/app/api-reference/file-conventions/route-segment-config/ensureStatic) with the `'navigation'` value, requiring all server-rendered work for the route to complete during prerendering. A page or layout on this route exports [`ensureStatic`](/docs/app/api-reference/file-conventions/route-segment-config/ensureStatic) with the `'navigation'` value, requiring all server-rendered work for the route to complete during prerendering.
During [prerendering](/docs/app/glossary#prerendering), [`generateViewport()`](/docs/app/api-reference/functions/generate-viewport) performed an uncached [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) request, database call, or [`connection()`](/docs/app/api-reference/functions/connection). The operation requires request-time server work and prevents `generateViewport()` from being fully prerendered. During [prerendering](/docs/app/glossary#prerendering), [`generateViewport()`](/docs/app/api-reference/functions/generate-viewport) performed an uncached [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) request, database call, or [`connection()`](/docs/app/api-reference/functions/connection). The operation requires rendering at request time, which conflicts with the route's static requirement.
During `next build`, Next.js may link to this page when it cannot distinguish uncached data from runtime data. For a short cache, [extend the cache lifetime](/docs/messages/static-viewport-runtime#extend-the-cache-lifetime). During `next build`, Next.js may link to this page when it cannot distinguish uncached data from runtime data. For a short cache, [extend the cache lifetime](/docs/messages/static-viewport-runtime#extend-the-cache-lifetime).
...@@ -113,7 +113,7 @@ The viewport is determined during prerendering rather than from the removed data ...@@ -113,7 +113,7 @@ The viewport is determined during prerendering rather than from the removed data
## Verifying the fix ## Verifying the fix
After applying a fix, rerun [`next build`](/docs/app/api-reference/cli/next#next-build-options) and confirm that the route completes prerendering. If the error also appeared in [`next dev`](/docs/app/api-reference/cli/next#next-dev-options), reload the route and confirm that the overlay clears. Wrapping the operation in Suspense or setting `instant = false` does not relax the fully static requirement. After applying a fix, rerun [`next build`](/docs/app/api-reference/cli/next#next-build-options) and confirm that the route completes prerendering. If the error also appeared in [`next dev`](/docs/app/api-reference/cli/next#next-dev-options), reload the route and confirm that the overlay clears. Wrapping the operation in Suspense or setting `instant = false` does not relax this static requirement.
In `next dev`, the error overlay points at the failing function with file paths and line numbers. Run [`next build --debug-prerender`](/docs/app/guides/building#debug-prerender-errors) for full user-frame stack traces and `next build --debug-build-paths /dashboard /settings` to iterate on specific routes. In `next dev`, the error overlay points at the failing function with file paths and line numbers. Run [`next build --debug-prerender`](/docs/app/guides/building#debug-prerender-errors) for full user-frame stack traces and `next build --debug-build-paths /dashboard /settings` to iterate on specific routes.
......
...@@ -22,7 +22,7 @@ kind: error ...@@ -22,7 +22,7 @@ kind: error
A page or layout on this route exports [`ensureStatic`](/docs/app/api-reference/file-conventions/route-segment-config/ensureStatic) with the `'navigation'` value, requiring all server-rendered work for the route to complete during prerendering. A page or layout on this route exports [`ensureStatic`](/docs/app/api-reference/file-conventions/route-segment-config/ensureStatic) with the `'navigation'` value, requiring all server-rendered work for the route to complete during prerendering.
During [prerendering](/docs/app/glossary#prerendering), [`generateViewport()`](/docs/app/api-reference/functions/generate-viewport) read request-specific data from [`cookies()`](/docs/app/api-reference/functions/cookies), [`headers()`](/docs/app/api-reference/functions/headers), [`params`](/docs/app/api-reference/file-conventions/page#params-optional), or [`searchParams`](/docs/app/api-reference/file-conventions/page#searchparams-optional). These values are only available for a request and prevent `generateViewport()` from being fully prerendered. During [prerendering](/docs/app/glossary#prerendering), [`generateViewport()`](/docs/app/api-reference/functions/generate-viewport) read request-specific data from [`cookies()`](/docs/app/api-reference/functions/cookies), [`headers()`](/docs/app/api-reference/functions/headers), [`params`](/docs/app/api-reference/file-conventions/page#params-optional), or [`searchParams`](/docs/app/api-reference/file-conventions/page#searchparams-optional). Reading these values in `generateViewport()` requires rendering at request time, which conflicts with the route's static requirement.
A [`use cache`](/docs/app/api-reference/directives/use-cache) scope also triggers this error when its [`expire`](/docs/app/api-reference/functions/cacheLife#expire) is under five minutes, [`stale`](/docs/app/api-reference/functions/cacheLife#stale) is under 30 seconds, or [`revalidate`](/docs/app/api-reference/functions/cacheLife#revalidate) is `0`. A [`use cache`](/docs/app/api-reference/directives/use-cache) scope also triggers this error when its [`expire`](/docs/app/api-reference/functions/cacheLife#expire) is under five minutes, [`stale`](/docs/app/api-reference/functions/cacheLife#stale) is under 30 seconds, or [`revalidate`](/docs/app/api-reference/functions/cacheLife#revalidate) is `0`.
...@@ -82,7 +82,7 @@ Learn more: [`cacheLife`](/docs/app/api-reference/functions/cacheLife). ...@@ -82,7 +82,7 @@ Learn more: [`cacheLife`](/docs/app/api-reference/functions/cacheLife).
## Verifying the fix ## Verifying the fix
After applying a fix, rerun [`next build`](/docs/app/api-reference/cli/next#next-build-options) and confirm that the route completes prerendering. If the error also appeared in [`next dev`](/docs/app/api-reference/cli/next#next-dev-options), reload the route and confirm that the overlay clears. Wrapping the access in Suspense or setting `instant = false` does not relax the fully static requirement. After applying a fix, rerun [`next build`](/docs/app/api-reference/cli/next#next-build-options) and confirm that the route completes prerendering. If the error also appeared in [`next dev`](/docs/app/api-reference/cli/next#next-dev-options), reload the route and confirm that the overlay clears. Wrapping the access in Suspense or setting `instant = false` does not relax this static requirement.
In `next dev`, the error overlay points at the failing function with file paths and line numbers. Run [`next build --debug-prerender`](/docs/app/guides/building#debug-prerender-errors) for full user-frame stack traces and `next build --debug-build-paths /dashboard /settings` to iterate on specific routes. In `next dev`, the error overlay points at the failing function with file paths and line numbers. Run [`next build --debug-prerender`](/docs/app/guides/building#debug-prerender-errors) for full user-frame stack traces and `next build --debug-build-paths /dashboard /settings` to iterate on specific routes.
......
...@@ -33,13 +33,13 @@ import { ...@@ -33,13 +33,13 @@ import {
describe('static route explanations', () => { describe('static route explanations', () => {
it('matches the fully static build guidance', () => { it('matches the fully static build guidance', () => {
expect(EXPLANATIONS['static-route']).toBe( expect(EXPLANATIONS['static-route']).toBe(
'This route is configured to be fully static, but data prevents it from being fully prerendered.' 'This route is configured to be fully static, but some data requires rendering at request time.'
) )
expect(EXPLANATIONS['static-metadata']).toBe( expect(EXPLANATIONS['static-metadata']).toBe(
'This route is configured to be fully static, but data prevents its metadata from being fully prerendered.' 'This route is configured to be fully static, but some data requires rendering at request time.'
) )
expect(EXPLANATIONS['static-viewport']).toBe( expect(EXPLANATIONS['static-viewport']).toBe(
'This route is configured to be fully static, but data prevents its viewport from being fully prerendered.' 'This route is configured to be fully static, but some data requires rendering at request time.'
) )
}) })
}) })
......
...@@ -711,8 +711,8 @@ const staticRouteRuntimeCards: FixCard[] = [ ...@@ -711,8 +711,8 @@ const staticRouteRuntimeCards: FixCard[] = [
group: 'client', group: 'client',
snippets: [ snippets: [
{ text: "'use client'" }, { text: "'use client'" },
{ text: "use(browser('Read cookie'))", highlight: true }, { text: 'use(browser())', highlight: true },
{ text: 'document.cookie.match(/cart=/)' }, { text: 'const value = readBrowserData()' },
], ],
copyable: true, copyable: true,
link: 'https://nextjs.org/docs/messages/static-route-runtime#read-the-data-on-the-client', link: 'https://nextjs.org/docs/messages/static-route-runtime#read-the-data-on-the-client',
...@@ -992,11 +992,11 @@ export const SYNC_IO_CLIENT_DOCS: Record<string, string> = { ...@@ -992,11 +992,11 @@ export const SYNC_IO_CLIENT_DOCS: Record<string, string> = {
export const EXPLANATIONS: Record<GuidanceKind, string> = { export const EXPLANATIONS: Record<GuidanceKind, string> = {
'static-viewport': 'static-viewport':
'This route is configured to be fully static, but data prevents its viewport from being fully prerendered.', 'This route is configured to be fully static, but some data requires rendering at request time.',
'static-metadata': 'static-metadata':
'This route is configured to be fully static, but data prevents its metadata from being fully prerendered.', 'This route is configured to be fully static, but some data requires rendering at request time.',
'static-route': 'static-route':
'This route is configured to be fully static, but data prevents it from being fully prerendered.', 'This route is configured to be fully static, but some data requires rendering at request time.',
'blocking-route': 'blocking-route':
'This prevents the route from being prerendered, blocking navigation and leading to a slower user experience.', 'This prevents the route from being prerendered, blocking navigation and leading to a slower user experience.',
'client-hook': 'client-hook':
......
...@@ -985,6 +985,30 @@ describe('deriveCauseFromCodeFrame', () => { ...@@ -985,6 +985,30 @@ describe('deriveCauseFromCodeFrame', () => {
}) })
describe('fully static route errors', () => { describe('fully static route errors', () => {
const runtimeDataExplanation =
'This route is configured to be fully static, but runtime data from `cookies()`, `headers()`, `params`, `searchParams`, or a short-lived cache requires rendering at request time.'
const uncachedDataExplanation =
'This route is configured to be fully static, but an uncached `fetch(...)`, database call, or `connection()` requires rendering at request time.'
const combinedDataExplanation =
'This route is configured to be fully static, but some data requires rendering at request time.'
it.each([
[createRuntimeBodyErrorInStaticRoute, runtimeDataExplanation],
[createDynamicBodyErrorInStaticRoute, uncachedDataExplanation],
[createNonPrerenderableBodyErrorInStaticRoute, combinedDataExplanation],
[createRuntimeMetadataErrorInStaticRoute, runtimeDataExplanation],
[createDynamicMetadataErrorInStaticRoute, uncachedDataExplanation],
[createNonPrerenderableMetadataErrorInStaticRoute, combinedDataExplanation],
[createRuntimeViewportErrorInStaticRoute, runtimeDataExplanation],
[createDynamicViewportErrorInStaticRoute, uncachedDataExplanation],
[createNonPrerenderableViewportErrorInStaticRoute, combinedDataExplanation],
] as const)(
'preserves the primary guidance for %p',
(createError, explanation) => {
expect(createError(ROUTE).message.split('\n\n')[1]).toBe(explanation)
}
)
it.each([ it.each([
[createRuntimeBodyErrorInStaticRoute, 'static-route', 'runtime'], [createRuntimeBodyErrorInStaticRoute, 'static-route', 'runtime'],
[createDynamicBodyErrorInStaticRoute, 'static-route', 'dynamic'], [createDynamicBodyErrorInStaticRoute, 'static-route', 'dynamic'],
......
...@@ -245,7 +245,7 @@ export function createDynamicOrRuntimeMetadataError(route: string): Error { ...@@ -245,7 +245,7 @@ export function createDynamicOrRuntimeMetadataError(route: string): Error {
export function createRuntimeBodyErrorInStaticRoute(route: string): Error { export function createRuntimeBodyErrorInStaticRoute(route: string): Error {
return new Error( return new Error(
`Route "${route}": Next.js encountered runtime data on a route that must be fully static.\n\n` + `Route "${route}": Next.js encountered runtime data on a route that must be fully static.\n\n` +
`This route is configured to be fully static, but runtime data from \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or a short-lived cache prevents it from being fully prerendered.\n\n` + `This route is configured to be fully static, but runtime data from \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or a short-lived cache requires rendering at request time.\n\n` +
`Ways to fix this:\n` + `Ways to fix this:\n` +
` - [remove] Remove the data access\n` + ` - [remove] Remove the data access\n` +
` - [client] Read the data on the client\n\n` + ` - [client] Read the data on the client\n\n` +
...@@ -256,7 +256,7 @@ export function createRuntimeBodyErrorInStaticRoute(route: string): Error { ...@@ -256,7 +256,7 @@ export function createRuntimeBodyErrorInStaticRoute(route: string): Error {
export function createDynamicBodyErrorInStaticRoute(route: string): Error { export function createDynamicBodyErrorInStaticRoute(route: string): Error {
return new Error( return new Error(
`Route "${route}": Next.js encountered uncached data on a route that must be fully static.\n\n` + `Route "${route}": Next.js encountered uncached data on a route that must be fully static.\n\n` +
`This route is configured to be fully static, but an uncached \`fetch(...)\`, database call, or \`connection()\` prevents it from being fully prerendered.\n\n` + `This route is configured to be fully static, but an uncached \`fetch(...)\`, database call, or \`connection()\` requires rendering at request time.\n\n` +
`Ways to fix this:\n` + `Ways to fix this:\n` +
` - [cache] Cache the data access with \`"use cache"\` (does not apply to \`connection()\`)\n` + ` - [cache] Cache the data access with \`"use cache"\` (does not apply to \`connection()\`)\n` +
` - [remove] Remove the data access\n` + ` - [remove] Remove the data access\n` +
...@@ -270,7 +270,7 @@ export function createNonPrerenderableBodyErrorInStaticRoute( ...@@ -270,7 +270,7 @@ export function createNonPrerenderableBodyErrorInStaticRoute(
): Error { ): Error {
return new Error( return new Error(
`Route "${route}": Next.js encountered uncached or runtime data on a route that must be fully static.\n\n` + `Route "${route}": Next.js encountered uncached or runtime data on a route that must be fully static.\n\n` +
`This route is configured to be fully static, but uncached or runtime data prevents it from being fully prerendered.\n\n` + `This route is configured to be fully static, but some data requires rendering at request time.\n\n` +
`Ways to fix this:\n` + `Ways to fix this:\n` +
` - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)\n` + ` - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)\n` +
` - [remove] Remove the data access\n` + ` - [remove] Remove the data access\n` +
...@@ -282,7 +282,7 @@ export function createNonPrerenderableBodyErrorInStaticRoute( ...@@ -282,7 +282,7 @@ export function createNonPrerenderableBodyErrorInStaticRoute(
export function createRuntimeMetadataErrorInStaticRoute(route: string): Error { export function createRuntimeMetadataErrorInStaticRoute(route: string): Error {
return new Error( return new Error(
`Route "${route}": Next.js encountered runtime data in \`generateMetadata()\` on a route that must be fully static.\n\n` + `Route "${route}": Next.js encountered runtime data in \`generateMetadata()\` on a route that must be fully static.\n\n` +
`This route is configured to be fully static, but runtime data from \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or a short-lived cache prevents \`generateMetadata()\` from being fully prerendered.\n\n` + `This route is configured to be fully static, but runtime data from \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or a short-lived cache requires rendering at request time.\n\n` +
`Ways to fix this:\n` + `Ways to fix this:\n` +
` - [static] Replace the dynamic data used by \`generateMetadata()\` with static data\n\n` + ` - [static] Replace the dynamic data used by \`generateMetadata()\` with static data\n\n` +
`Learn more: https://nextjs.org/docs/messages/static-metadata-runtime` `Learn more: https://nextjs.org/docs/messages/static-metadata-runtime`
...@@ -292,7 +292,7 @@ export function createRuntimeMetadataErrorInStaticRoute(route: string): Error { ...@@ -292,7 +292,7 @@ export function createRuntimeMetadataErrorInStaticRoute(route: string): Error {
export function createDynamicMetadataErrorInStaticRoute(route: string): Error { export function createDynamicMetadataErrorInStaticRoute(route: string): Error {
return new Error( return new Error(
`Route "${route}": Next.js encountered uncached data in \`generateMetadata()\` on a route that must be fully static.\n\n` + `Route "${route}": Next.js encountered uncached data in \`generateMetadata()\` on a route that must be fully static.\n\n` +
`This route is configured to be fully static, but an uncached \`fetch(...)\`, database call, or \`connection()\` prevents \`generateMetadata()\` from being fully prerendered.\n\n` + `This route is configured to be fully static, but an uncached \`fetch(...)\`, database call, or \`connection()\` requires rendering at request time.\n\n` +
`Ways to fix this:\n` + `Ways to fix this:\n` +
` - [cache] Cache the data used by \`generateMetadata()\` with \`"use cache"\` (does not apply to \`connection()\`)\n` + ` - [cache] Cache the data used by \`generateMetadata()\` with \`"use cache"\` (does not apply to \`connection()\`)\n` +
` - [static] Replace the dynamic data used by \`generateMetadata()\` with static data\n\n` + ` - [static] Replace the dynamic data used by \`generateMetadata()\` with static data\n\n` +
...@@ -305,7 +305,7 @@ export function createNonPrerenderableMetadataErrorInStaticRoute( ...@@ -305,7 +305,7 @@ export function createNonPrerenderableMetadataErrorInStaticRoute(
): Error { ): Error {
return new Error( return new Error(
`Route "${route}": Next.js encountered uncached or runtime data in \`generateMetadata()\` on a route that must be fully static.\n\n` + `Route "${route}": Next.js encountered uncached or runtime data in \`generateMetadata()\` on a route that must be fully static.\n\n` +
`This route is configured to be fully static, but uncached or runtime data prevents \`generateMetadata()\` from being fully prerendered.\n\n` + `This route is configured to be fully static, but some data requires rendering at request time.\n\n` +
`Ways to fix this:\n` + `Ways to fix this:\n` +
` - [cache] For uncached data: cache the data used by \`generateMetadata()\` with \`"use cache"\` (does not apply to \`connection()\`)\n` + ` - [cache] For uncached data: cache the data used by \`generateMetadata()\` with \`"use cache"\` (does not apply to \`connection()\`)\n` +
` - [static] Replace the dynamic data used by \`generateMetadata()\` with static data\n\n` + ` - [static] Replace the dynamic data used by \`generateMetadata()\` with static data\n\n` +
...@@ -316,7 +316,7 @@ export function createNonPrerenderableMetadataErrorInStaticRoute( ...@@ -316,7 +316,7 @@ export function createNonPrerenderableMetadataErrorInStaticRoute(
export function createRuntimeViewportErrorInStaticRoute(route: string): Error { export function createRuntimeViewportErrorInStaticRoute(route: string): Error {
return new Error( return new Error(
`Route "${route}": Next.js encountered runtime data in \`generateViewport()\` on a route that must be fully static.\n\n` + `Route "${route}": Next.js encountered runtime data in \`generateViewport()\` on a route that must be fully static.\n\n` +
`This route is configured to be fully static, but runtime data from \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or a short-lived cache prevents \`generateViewport()\` from being fully prerendered.\n\n` + `This route is configured to be fully static, but runtime data from \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or a short-lived cache requires rendering at request time.\n\n` +
`Ways to fix this:\n` + `Ways to fix this:\n` +
` - [static] Replace the dynamic data used by \`generateViewport()\` with static data\n\n` + ` - [static] Replace the dynamic data used by \`generateViewport()\` with static data\n\n` +
`Learn more: https://nextjs.org/docs/messages/static-viewport-runtime` `Learn more: https://nextjs.org/docs/messages/static-viewport-runtime`
...@@ -326,7 +326,7 @@ export function createRuntimeViewportErrorInStaticRoute(route: string): Error { ...@@ -326,7 +326,7 @@ export function createRuntimeViewportErrorInStaticRoute(route: string): Error {
export function createDynamicViewportErrorInStaticRoute(route: string): Error { export function createDynamicViewportErrorInStaticRoute(route: string): Error {
return new Error( return new Error(
`Route "${route}": Next.js encountered uncached data in \`generateViewport()\` on a route that must be fully static.\n\n` + `Route "${route}": Next.js encountered uncached data in \`generateViewport()\` on a route that must be fully static.\n\n` +
`This route is configured to be fully static, but an uncached \`fetch(...)\`, database call, or \`connection()\` prevents \`generateViewport()\` from being fully prerendered.\n\n` + `This route is configured to be fully static, but an uncached \`fetch(...)\`, database call, or \`connection()\` requires rendering at request time.\n\n` +
`Ways to fix this:\n` + `Ways to fix this:\n` +
` - [cache] Cache the data used by \`generateViewport()\` with \`"use cache"\` (does not apply to \`connection()\`)\n` + ` - [cache] Cache the data used by \`generateViewport()\` with \`"use cache"\` (does not apply to \`connection()\`)\n` +
` - [static] Replace the dynamic data used by \`generateViewport()\` with static data\n\n` + ` - [static] Replace the dynamic data used by \`generateViewport()\` with static data\n\n` +
...@@ -339,7 +339,7 @@ export function createNonPrerenderableViewportErrorInStaticRoute( ...@@ -339,7 +339,7 @@ export function createNonPrerenderableViewportErrorInStaticRoute(
): Error { ): Error {
return new Error( return new Error(
`Route "${route}": Next.js encountered uncached or runtime data in \`generateViewport()\` on a route that must be fully static.\n\n` + `Route "${route}": Next.js encountered uncached or runtime data in \`generateViewport()\` on a route that must be fully static.\n\n` +
`This route is configured to be fully static, but uncached or runtime data prevents \`generateViewport()\` from being fully prerendered.\n\n` + `This route is configured to be fully static, but some data requires rendering at request time.\n\n` +
`Ways to fix this:\n` + `Ways to fix this:\n` +
` - [cache] For uncached data: cache the data used by \`generateViewport()\` with \`"use cache"\` (does not apply to \`connection()\`)\n` + ` - [cache] For uncached data: cache the data used by \`generateViewport()\` with \`"use cache"\` (does not apply to \`connection()\`)\n` +
` - [static] Replace the dynamic data used by \`generateViewport()\` with static data\n\n` + ` - [static] Replace the dynamic data used by \`generateViewport()\` with static data\n\n` +
......
...@@ -228,7 +228,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -228,7 +228,7 @@ describe('ensureStatic = "navigation"', () => {
expect(error).toMatchInlineSnapshot(` expect(error).toMatchInlineSnapshot(`
"Error: Route "/default/uncached-data": Next.js encountered uncached or runtime data on a route that must be fully static. "Error: Route "/default/uncached-data": Next.js encountered uncached or runtime data on a route that must be fully static.
This route is configured to be fully static, but uncached or runtime data prevents it from being fully prerendered. This route is configured to be fully static, but some data requires rendering at request time.
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
...@@ -283,7 +283,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -283,7 +283,7 @@ describe('ensureStatic = "navigation"', () => {
expect(error).toMatchInlineSnapshot(` expect(error).toMatchInlineSnapshot(`
"Error: Route "/default/connection": Next.js encountered uncached or runtime data on a route that must be fully static. "Error: Route "/default/connection": Next.js encountered uncached or runtime data on a route that must be fully static.
This route is configured to be fully static, but uncached or runtime data prevents it from being fully prerendered. This route is configured to be fully static, but some data requires rendering at request time.
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
...@@ -338,7 +338,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -338,7 +338,7 @@ describe('ensureStatic = "navigation"', () => {
expect(error).toMatchInlineSnapshot(` expect(error).toMatchInlineSnapshot(`
"Error: Route "/default/instant-false/connection-blocking": Next.js encountered uncached or runtime data on a route that must be fully static. "Error: Route "/default/instant-false/connection-blocking": Next.js encountered uncached or runtime data on a route that must be fully static.
This route is configured to be fully static, but uncached or runtime data prevents it from being fully prerendered. This route is configured to be fully static, but some data requires rendering at request time.
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
...@@ -393,7 +393,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -393,7 +393,7 @@ describe('ensureStatic = "navigation"', () => {
expect(error).toMatchInlineSnapshot(` expect(error).toMatchInlineSnapshot(`
"Error: Route "/suspense-above-body/connection-blocking": Next.js encountered uncached or runtime data on a route that must be fully static. "Error: Route "/suspense-above-body/connection-blocking": Next.js encountered uncached or runtime data on a route that must be fully static.
This route is configured to be fully static, but uncached or runtime data prevents it from being fully prerendered. This route is configured to be fully static, but some data requires rendering at request time.
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
...@@ -448,7 +448,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -448,7 +448,7 @@ describe('ensureStatic = "navigation"', () => {
expect(error).toMatchInlineSnapshot(` expect(error).toMatchInlineSnapshot(`
"Error: Route "/default/dynamic-data-passed-to-client": Next.js encountered uncached or runtime data on a route that must be fully static. "Error: Route "/default/dynamic-data-passed-to-client": Next.js encountered uncached or runtime data on a route that must be fully static.
This route is configured to be fully static, but uncached or runtime data prevents it from being fully prerendered. This route is configured to be fully static, but some data requires rendering at request time.
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
...@@ -660,7 +660,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -660,7 +660,7 @@ describe('ensureStatic = "navigation"', () => {
expect(error).toMatchInlineSnapshot(` expect(error).toMatchInlineSnapshot(`
"Error: Route "/default/dynamic-metadata": Next.js encountered uncached or runtime data in \`generateMetadata()\` on a route that must be fully static. "Error: Route "/default/dynamic-metadata": Next.js encountered uncached or runtime data in \`generateMetadata()\` on a route that must be fully static.
This route is configured to be fully static, but uncached or runtime data prevents \`generateMetadata()\` from being fully prerendered. This route is configured to be fully static, but some data requires rendering at request time.
Ways to fix this: Ways to fix this:
- [cache] For uncached data: cache the data used by \`generateMetadata()\` with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data: cache the data used by \`generateMetadata()\` with \`"use cache"\` (does not apply to \`connection()\`)
...@@ -712,7 +712,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -712,7 +712,7 @@ describe('ensureStatic = "navigation"', () => {
expect(error).toMatchInlineSnapshot(` expect(error).toMatchInlineSnapshot(`
"Error: Route "/default/dynamic-viewport": Next.js encountered uncached or runtime data in \`generateViewport()\` on a route that must be fully static. "Error: Route "/default/dynamic-viewport": Next.js encountered uncached or runtime data in \`generateViewport()\` on a route that must be fully static.
This route is configured to be fully static, but uncached or runtime data prevents \`generateViewport()\` from being fully prerendered. This route is configured to be fully static, but some data requires rendering at request time.
Ways to fix this: Ways to fix this:
- [cache] For uncached data: cache the data used by \`generateViewport()\` with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data: cache the data used by \`generateViewport()\` with \`"use cache"\` (does not apply to \`connection()\`)
...@@ -931,7 +931,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -931,7 +931,7 @@ describe('ensureStatic = "navigation"', () => {
expect(error).toMatchInlineSnapshot(` expect(error).toMatchInlineSnapshot(`
"Error: Route "/default/excluded-caches/non-prerenderable-cache": Next.js encountered uncached or runtime data on a route that must be fully static. "Error: Route "/default/excluded-caches/non-prerenderable-cache": Next.js encountered uncached or runtime data on a route that must be fully static.
This route is configured to be fully static, but uncached or runtime data prevents it from being fully prerendered. This route is configured to be fully static, but some data requires rendering at request time.
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
...@@ -1202,7 +1202,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -1202,7 +1202,7 @@ describe('ensureStatic = "navigation"', () => {
expect(error).toMatchInlineSnapshot(` expect(error).toMatchInlineSnapshot(`
"Error: Route "/default/mixed-server-client/connection-and-browser": Next.js encountered uncached or runtime data on a route that must be fully static. "Error: Route "/default/mixed-server-client/connection-and-browser": Next.js encountered uncached or runtime data on a route that must be fully static.
This route is configured to be fully static, but uncached or runtime data prevents it from being fully prerendered. This route is configured to be fully static, but some data requires rendering at request time.
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
...@@ -1258,7 +1258,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -1258,7 +1258,7 @@ describe('ensureStatic = "navigation"', () => {
expect(error).toMatchInlineSnapshot(` expect(error).toMatchInlineSnapshot(`
"Error: Route "/default/mixed-server-client/connection-and-use-search-params": Next.js encountered uncached or runtime data on a route that must be fully static. "Error: Route "/default/mixed-server-client/connection-and-use-search-params": Next.js encountered uncached or runtime data on a route that must be fully static.
This route is configured to be fully static, but uncached or runtime data prevents it from being fully prerendered. This route is configured to be fully static, but some data requires rendering at request time.
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
...@@ -1340,7 +1340,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -1340,7 +1340,7 @@ describe('ensureStatic = "navigation"', () => {
expect(error).toMatchInlineSnapshot(` expect(error).toMatchInlineSnapshot(`
"Error: Route "/default/mixed-server-client/connection-and-use-io": Next.js encountered uncached or runtime data on a route that must be fully static. "Error: Route "/default/mixed-server-client/connection-and-use-io": Next.js encountered uncached or runtime data on a route that must be fully static.
This route is configured to be fully static, but uncached or runtime data prevents it from being fully prerendered. This route is configured to be fully static, but some data requires rendering at request time.
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
...@@ -1360,7 +1360,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -1360,7 +1360,7 @@ describe('ensureStatic = "navigation"', () => {
To debug the issue, start the app in development mode by running \`next dev\`, then open "/default/mixed-server-client/connection-and-use-io" in your browser to investigate the error. To debug the issue, start the app in development mode by running \`next dev\`, then open "/default/mixed-server-client/connection-and-use-io" in your browser to investigate the error.
Error: Route "/default/mixed-server-client/connection-and-use-io": Next.js encountered uncached or runtime data on a route that must be fully static. Error: Route "/default/mixed-server-client/connection-and-use-io": Next.js encountered uncached or runtime data on a route that must be fully static.
This route is configured to be fully static, but uncached or runtime data prevents it from being fully prerendered. This route is configured to be fully static, but some data requires rendering at request time.
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
......
...@@ -1434,7 +1434,7 @@ export function registerHeadAndReportingTests( ...@@ -1434,7 +1434,7 @@ export function registerHeadAndReportingTests(
expect(error).toMatchInlineSnapshot(` expect(error).toMatchInlineSnapshot(`
"Error: Route "/shells/ensure-static/navigation/session-data-without-suspense": Next.js encountered uncached or runtime data on a route that must be fully static. "Error: Route "/shells/ensure-static/navigation/session-data-without-suspense": Next.js encountered uncached or runtime data on a route that must be fully static.
This route is configured to be fully static, but uncached or runtime data prevents it from being fully prerendered. This route is configured to be fully static, but some data requires rendering at request time.
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment