Unverified Commit c0a661ee authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[instant] Allow providing user feedback for blocking route errors (#90498)

parent 38b69ff7
...@@ -1073,5 +1073,16 @@ ...@@ -1073,5 +1073,16 @@
"1072": "Missing segment data: <head>", "1072": "Missing segment data: <head>",
"1073": "Expected static stage body to be available", "1073": "Expected static stage body to be available",
"1074": "Page \"%s\" cannot use both \"use client\" and export const \"unstable_instant\".", "1074": "Page \"%s\" cannot use both \"use client\" and export const \"unstable_instant\".",
"1075": "Page \"%s\" cannot export \"unstable_instant\" from a Client Component module. To use this API, convert this module to a Server Component by removing the \"use client\" directive." "1075": "Page \"%s\" cannot export \"unstable_instant\" from a Client Component module. To use this API, convert this module to a Server Component by removing the \"use client\" directive.",
"1076": "Route \"%s\": %s Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata",
"1077": "Route \"%s\": Uncached data or \\`connection()\\` was accessed inside \\`generateViewport\\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport",
"1078": "Route \"%s\": %s This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route",
"1079": "Route \"%s\": Uncached data was accessed outside of <Suspense>. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route",
"1080": "Route \"%s\": Uncached data or \\`connection()\\` was accessed inside \\`generateMetadata\\`. Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata",
"1081": "Route \"%s\": Runtime data such as \\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` was accessed inside \\`generateViewport\\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport",
"1082": "Route \"%s\": Could not validate \\`unstable_instant\\` because a Client Component in a parent segment prevented the page from rendering.",
"1083": "Route \"%s\": Runtime data such as \\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` was accessed outside of \\`<Suspense>\\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route",
"1084": "Route \"%s\": Uncached data or \\`connection()\\` was accessed outside of \\`<Suspense>\\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route",
"1085": "Route \"%s\": Runtime data such as \\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` was accessed inside \\`generateMetadata\\` or you have file-based metadata such as icons that depend on dynamic params segments. Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata",
"1086": "Route \"%s\": %s This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport"
} }
...@@ -512,7 +512,10 @@ export function processMessage( ...@@ -512,7 +512,10 @@ export function processMessage(
return return
} }
case HMR_MESSAGE_SENT_TO_BROWSER.ERRORS_TO_SHOW_IN_BROWSER: { case HMR_MESSAGE_SENT_TO_BROWSER.ERRORS_TO_SHOW_IN_BROWSER: {
createFromReadableStream<Error[]>( createFromReadableStream<{
errors: Error[]
errorCodes: Map<Error, string>
}>(
new ReadableStream({ new ReadableStream({
start(controller) { start(controller) {
controller.enqueue(message.serializedErrors) controller.enqueue(message.serializedErrors)
...@@ -521,8 +524,16 @@ export function processMessage( ...@@ -521,8 +524,16 @@ export function processMessage(
}), }),
{ findSourceMapURL } { findSourceMapURL }
).then( ).then(
(errors) => { ({ errors, errorCodes }) => {
for (const error of errors) { for (const error of errors) {
const code = errorCodes.get(error)
if (code !== undefined) {
Object.defineProperty(error, '__NEXT_ERROR_CODE', {
value: code,
enumerable: false,
configurable: true,
})
}
console.error(error) console.error(error)
} }
}, },
......
...@@ -132,6 +132,7 @@ import { ...@@ -132,6 +132,7 @@ import {
isStaticGenBailoutError, isStaticGenBailoutError,
} from '../../client/components/static-generation-bailout' } from '../../client/components/static-generation-bailout'
import { getStackWithoutErrorMessage } from '../../lib/format-server-error' import { getStackWithoutErrorMessage } from '../../lib/format-server-error'
import { extractNextErrorCode } from '../../lib/error-telemetry-utils'
import { import {
accessedDynamicData, accessedDynamicData,
createRenderInBrowserAbortSignal, createRenderInBrowserAbortSignal,
...@@ -3719,11 +3720,23 @@ async function logMessagesAndSendErrorsToBrowser( ...@@ -3719,11 +3720,23 @@ async function logMessagesAndSendErrorsToBrowser(
) )
} }
// Build a Map of error → error code for errors that have one.
// React doesn't revive __NEXT_ERROR_CODE during RSC deserialization, so we
// send it as a side-channel Map. RSC preserves object identity, so the
// deserialized Map keys will reference the same Error objects.
const errorCodes = new Map<Error, string>()
for (const err of errors) {
const code = extractNextErrorCode(err)
if (code !== undefined) {
errorCodes.set(err, code)
}
}
const { clientModules } = getClientReferenceManifest() const { clientModules } = getClientReferenceManifest()
const errorsFlightStream = renderToFlightStream( const errorsFlightStream = renderToFlightStream(
ctx.componentMod, ctx.componentMod,
errors, { errors, errorCodes },
clientModules, clientModules,
{ filterStackFrame } { filterStackFrame }
) )
......
...@@ -769,11 +769,7 @@ export function trackAllowedDynamicAccess( ...@@ -769,11 +769,7 @@ export function trackAllowedDynamicAccess(
'<Suspense>. This delays the entire page from rendering, resulting in a ' + '<Suspense>. This delays the entire page from rendering, resulting in a ' +
'slow user experience. Learn more: ' + 'slow user experience. Learn more: ' +
'https://nextjs.org/docs/messages/blocking-route' 'https://nextjs.org/docs/messages/blocking-route'
const error = createErrorWithComponentOrOwnerStack( const error = addErrorContext(new Error(message), componentStack, null)
message,
componentStack,
null
)
dynamicValidation.dynamicErrors.push(error) dynamicValidation.dynamicErrors.push(error)
return return
} }
...@@ -833,8 +829,8 @@ export function trackDynamicHoleInNavigation( ...@@ -833,8 +829,8 @@ export function trackDynamicHoleInNavigation(
? `Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed inside \`generateMetadata\` or you have file-based metadata such as icons that depend on dynamic params segments.` ? `Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed inside \`generateMetadata\` or you have file-based metadata such as icons that depend on dynamic params segments.`
: `Uncached data or \`connection()\` was accessed inside \`generateMetadata\`.` : `Uncached data or \`connection()\` was accessed inside \`generateMetadata\`.`
const message = `Route "${workStore.route}": ${usageDescription} Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata` const message = `Route "${workStore.route}": ${usageDescription} Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata`
const error = createErrorWithComponentOrOwnerStack( const error = addErrorContext(
message, new Error(message),
componentStack, componentStack,
dynamicValidation.createInstantStack dynamicValidation.createInstantStack
) )
...@@ -847,8 +843,8 @@ export function trackDynamicHoleInNavigation( ...@@ -847,8 +843,8 @@ export function trackDynamicHoleInNavigation(
? `Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed inside \`generateViewport\`.` ? `Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed inside \`generateViewport\`.`
: `Uncached data or \`connection()\` was accessed inside \`generateViewport\`.` : `Uncached data or \`connection()\` was accessed inside \`generateViewport\`.`
const message = `Route "${workStore.route}": ${usageDescription} This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport` const message = `Route "${workStore.route}": ${usageDescription} This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport`
const error = createErrorWithComponentOrOwnerStack( const error = addErrorContext(
message, new Error(message),
componentStack, componentStack,
dynamicValidation.createInstantStack dynamicValidation.createInstantStack
) )
...@@ -877,8 +873,8 @@ export function trackDynamicHoleInNavigation( ...@@ -877,8 +873,8 @@ export function trackDynamicHoleInNavigation(
// the errors from the innermost (segments), i.e. omit layouts whose // the errors from the innermost (segments), i.e. omit layouts whose
// slots managed to render (because clearly they didn't block validation) // slots managed to render (because clearly they didn't block validation)
const message = `Route "${workStore.route}": Could not validate \`unstable_instant\` because a Client Component in a parent segment prevented the page from rendering.` const message = `Route "${workStore.route}": Could not validate \`unstable_instant\` because a Client Component in a parent segment prevented the page from rendering.`
const error = createErrorWithComponentOrOwnerStack( const error = addErrorContext(
message, new Error(message),
componentStack, componentStack,
dynamicValidation.createInstantStack dynamicValidation.createInstantStack
) )
...@@ -935,8 +931,8 @@ export function trackDynamicHoleInNavigation( ...@@ -935,8 +931,8 @@ export function trackDynamicHoleInNavigation(
? `Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed outside of \`<Suspense>\`.` ? `Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed outside of \`<Suspense>\`.`
: `Uncached data or \`connection()\` was accessed outside of \`<Suspense>\`.` : `Uncached data or \`connection()\` was accessed outside of \`<Suspense>\`.`
const message = `Route "${workStore.route}": ${usageDescription} This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route` const message = `Route "${workStore.route}": ${usageDescription} This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`
const error = createErrorWithComponentOrOwnerStack( const error = addErrorContext(
message, new Error(message),
componentStack, componentStack,
dynamicValidation.createInstantStack dynamicValidation.createInstantStack
) )
...@@ -968,11 +964,7 @@ export function trackDynamicHoleInRuntimeShell( ...@@ -968,11 +964,7 @@ export function trackDynamicHoleInRuntimeShell(
return return
} else if (hasMetadataRegex.test(componentStack)) { } else if (hasMetadataRegex.test(componentStack)) {
const message = `Route "${workStore.route}": Uncached data or \`connection()\` was accessed inside \`generateMetadata\`. Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata` const message = `Route "${workStore.route}": Uncached data or \`connection()\` was accessed inside \`generateMetadata\`. Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata`
const error = createErrorWithComponentOrOwnerStack( const error = addErrorContext(new Error(message), componentStack, null)
message,
componentStack,
null
)
dynamicValidation.dynamicMetadata = error dynamicValidation.dynamicMetadata = error
return return
} else if (hasViewportRegex.test(componentStack)) { } else if (hasViewportRegex.test(componentStack)) {
...@@ -980,11 +972,7 @@ export function trackDynamicHoleInRuntimeShell( ...@@ -980,11 +972,7 @@ export function trackDynamicHoleInRuntimeShell(
// we won't find out if there's a suspense-above-body and error for dynamic viewport // we won't find out if there's a suspense-above-body and error for dynamic viewport
// even if there is in fact a suspense-above-body // even if there is in fact a suspense-above-body
const message = `Route "${workStore.route}": Uncached data or \`connection()\` was accessed inside \`generateViewport\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport` const message = `Route "${workStore.route}": Uncached data or \`connection()\` was accessed inside \`generateViewport\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport`
const error = createErrorWithComponentOrOwnerStack( const error = addErrorContext(new Error(message), componentStack, null)
message,
componentStack,
null
)
dynamicValidation.dynamicErrors.push(error) dynamicValidation.dynamicErrors.push(error)
return return
} else if ( } else if (
...@@ -1012,11 +1000,7 @@ export function trackDynamicHoleInRuntimeShell( ...@@ -1012,11 +1000,7 @@ export function trackDynamicHoleInRuntimeShell(
} }
const message = `Route "${workStore.route}": Uncached data or \`connection()\` was accessed outside of \`<Suspense>\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route` const message = `Route "${workStore.route}": Uncached data or \`connection()\` was accessed outside of \`<Suspense>\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`
const error = createErrorWithComponentOrOwnerStack( const error = addErrorContext(new Error(message), componentStack, null)
message,
componentStack,
null
)
dynamicValidation.dynamicErrors.push(error) dynamicValidation.dynamicErrors.push(error)
return return
} }
...@@ -1032,20 +1016,12 @@ export function trackDynamicHoleInStaticShell( ...@@ -1032,20 +1016,12 @@ export function trackDynamicHoleInStaticShell(
return return
} else if (hasMetadataRegex.test(componentStack)) { } else if (hasMetadataRegex.test(componentStack)) {
const message = `Route "${workStore.route}": Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed inside \`generateMetadata\` or you have file-based metadata such as icons that depend on dynamic params segments. Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata` const message = `Route "${workStore.route}": Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed inside \`generateMetadata\` or you have file-based metadata such as icons that depend on dynamic params segments. Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata`
const error = createErrorWithComponentOrOwnerStack( const error = addErrorContext(new Error(message), componentStack, null)
message,
componentStack,
null
)
dynamicValidation.dynamicMetadata = error dynamicValidation.dynamicMetadata = error
return return
} else if (hasViewportRegex.test(componentStack)) { } else if (hasViewportRegex.test(componentStack)) {
const message = `Route "${workStore.route}": Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed inside \`generateViewport\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport` const message = `Route "${workStore.route}": Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed inside \`generateViewport\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport`
const error = createErrorWithComponentOrOwnerStack( const error = addErrorContext(new Error(message), componentStack, null)
message,
componentStack,
null
)
dynamicValidation.dynamicErrors.push(error) dynamicValidation.dynamicErrors.push(error)
return return
} else if ( } else if (
...@@ -1072,11 +1048,7 @@ export function trackDynamicHoleInStaticShell( ...@@ -1072,11 +1048,7 @@ export function trackDynamicHoleInStaticShell(
return return
} else { } else {
const message = `Route "${workStore.route}": Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed outside of \`<Suspense>\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route` const message = `Route "${workStore.route}": Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed outside of \`<Suspense>\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`
const error = createErrorWithComponentOrOwnerStack( const error = addErrorContext(new Error(message), componentStack, null)
message,
componentStack,
null
)
dynamicValidation.dynamicErrors.push(error) dynamicValidation.dynamicErrors.push(error)
return return
} }
...@@ -1085,9 +1057,12 @@ export function trackDynamicHoleInStaticShell( ...@@ -1085,9 +1057,12 @@ export function trackDynamicHoleInStaticShell(
/** /**
* In dev mode, we prefer using the owner stack, otherwise the provided * In dev mode, we prefer using the owner stack, otherwise the provided
* component stack is used. * component stack is used.
*
* Accepts an already-created Error so the SWC error-code plugin can see the
* `new Error(...)` call at each call site and auto-assign error codes.
*/ */
function createErrorWithComponentOrOwnerStack( function addErrorContext(
message: string, error: Error,
componentStack: string, componentStack: string,
createInstantStack: (() => Error) | null createInstantStack: (() => Error) | null
) { ) {
...@@ -1096,11 +1071,13 @@ function createErrorWithComponentOrOwnerStack( ...@@ -1096,11 +1071,13 @@ function createErrorWithComponentOrOwnerStack(
? React.captureOwnerStack() ? React.captureOwnerStack()
: null : null
const cause = createInstantStack !== null ? createInstantStack() : null if (createInstantStack !== null) {
const error = new Error(message, cause !== null ? { cause } : undefined) error.cause = createInstantStack()
}
// TODO go back to owner stack here if available. This is temporarily using componentStack to get the right // TODO go back to owner stack here if available. This is temporarily using componentStack to get the right
// //
error.stack = error.name + ': ' + message + (ownerStack || componentStack) error.stack =
error.name + ': ' + error.message + (ownerStack || componentStack)
return error return error
} }
......
...@@ -21,6 +21,7 @@ describe('Cache Components Dev Errors', () => { ...@@ -21,6 +21,7 @@ describe('Cache Components Dev Errors', () => {
// soft-navigating to the page (see test below). // soft-navigating to the page (see test below).
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E394",
"description": "Route "/error" used \`Math.random()\` before accessing either uncached data (e.g. \`fetch()\`) or Request data (e.g. \`cookies()\`, \`headers()\`, \`connection()\`, and \`searchParams\`). Accessing random values synchronously in a Server Component requires reading one of these data sources first. Alternatively, consider moving this expression into a Client Component or Cache Component. See more info here: https://nextjs.org/docs/messages/next-prerender-random", "description": "Route "/error" used \`Math.random()\` before accessing either uncached data (e.g. \`fetch()\`) or Request data (e.g. \`cookies()\`, \`headers()\`, \`connection()\`, and \`searchParams\`). Accessing random values synchronously in a Server Component requires reading one of these data sources first. Alternatively, consider moving this expression into a Client Component or Cache Component. See more info here: https://nextjs.org/docs/messages/next-prerender-random",
"environmentLabel": "Server", "environmentLabel": "Server",
"label": "Console Error", "label": "Console Error",
...@@ -50,6 +51,7 @@ describe('Cache Components Dev Errors', () => { ...@@ -50,6 +51,7 @@ describe('Cache Components Dev Errors', () => {
// TODO: React should not include the anon stack in the Owner Stack. // TODO: React should not include the anon stack in the Owner Stack.
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E394",
"description": "Route "/error" used \`Math.random()\` before accessing either uncached data (e.g. \`fetch()\`) or Request data (e.g. \`cookies()\`, \`headers()\`, \`connection()\`, and \`searchParams\`). Accessing random values synchronously in a Server Component requires reading one of these data sources first. Alternatively, consider moving this expression into a Client Component or Cache Component. See more info here: https://nextjs.org/docs/messages/next-prerender-random", "description": "Route "/error" used \`Math.random()\` before accessing either uncached data (e.g. \`fetch()\`) or Request data (e.g. \`cookies()\`, \`headers()\`, \`connection()\`, and \`searchParams\`). Accessing random values synchronously in a Server Component requires reading one of these data sources first. Alternatively, consider moving this expression into a Client Component or Cache Component. See more info here: https://nextjs.org/docs/messages/next-prerender-random",
"environmentLabel": "Server", "environmentLabel": "Server",
"label": "Console Error", "label": "Console Error",
...@@ -96,6 +98,7 @@ describe('Cache Components Dev Errors', () => { ...@@ -96,6 +98,7 @@ describe('Cache Components Dev Errors', () => {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1084",
"description": "Data that blocks navigation was accessed outside of <Suspense> "description": "Data that blocks navigation was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. Uncached data such as fetch(...), cached data with a low expire time, or connection() are all examples of data that only resolve on navigation. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. Uncached data such as fetch(...), cached data with a low expire time, or connection() are all examples of data that only resolve on navigation.
......
...@@ -52,6 +52,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -52,6 +52,7 @@ describe('Cache Components Fallback Validation', () => {
if (isTurbopack) { if (isTurbopack) {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -80,6 +81,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -80,6 +81,7 @@ describe('Cache Components Fallback Validation', () => {
} else { } else {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -111,6 +113,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -111,6 +113,7 @@ describe('Cache Components Fallback Validation', () => {
if (isTurbopack) { if (isTurbopack) {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -139,6 +142,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -139,6 +142,7 @@ describe('Cache Components Fallback Validation', () => {
} else { } else {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -170,6 +174,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -170,6 +174,7 @@ describe('Cache Components Fallback Validation', () => {
if (isTurbopack) { if (isTurbopack) {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -198,6 +203,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -198,6 +203,7 @@ describe('Cache Components Fallback Validation', () => {
} else { } else {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -233,6 +239,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -233,6 +239,7 @@ describe('Cache Components Fallback Validation', () => {
if (isTurbopack) { if (isTurbopack) {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -261,6 +268,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -261,6 +268,7 @@ describe('Cache Components Fallback Validation', () => {
} else { } else {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -292,6 +300,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -292,6 +300,7 @@ describe('Cache Components Fallback Validation', () => {
if (isTurbopack) { if (isTurbopack) {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -320,6 +329,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -320,6 +329,7 @@ describe('Cache Components Fallback Validation', () => {
} else { } else {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -351,6 +361,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -351,6 +361,7 @@ describe('Cache Components Fallback Validation', () => {
if (isTurbopack) { if (isTurbopack) {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -379,6 +390,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -379,6 +390,7 @@ describe('Cache Components Fallback Validation', () => {
} else { } else {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -410,6 +422,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -410,6 +422,7 @@ describe('Cache Components Fallback Validation', () => {
if (isTurbopack) { if (isTurbopack) {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -438,6 +451,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -438,6 +451,7 @@ describe('Cache Components Fallback Validation', () => {
} else { } else {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -469,6 +483,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -469,6 +483,7 @@ describe('Cache Components Fallback Validation', () => {
if (isTurbopack) { if (isTurbopack) {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -497,6 +512,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -497,6 +512,7 @@ describe('Cache Components Fallback Validation', () => {
} else { } else {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -528,6 +544,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -528,6 +544,7 @@ describe('Cache Components Fallback Validation', () => {
if (isTurbopack) { if (isTurbopack) {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -556,6 +573,7 @@ describe('Cache Components Fallback Validation', () => { ...@@ -556,6 +573,7 @@ describe('Cache Components Fallback Validation', () => {
} else { } else {
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1083",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
......
...@@ -105,6 +105,7 @@ describe('instant validation causes', () => { ...@@ -105,6 +105,7 @@ describe('instant validation causes', () => {
], ],
}, },
], ],
"code": "E1078",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -149,6 +150,7 @@ describe('instant validation causes', () => { ...@@ -149,6 +150,7 @@ describe('instant validation causes', () => {
], ],
}, },
], ],
"code": "E1078",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -193,6 +195,7 @@ describe('instant validation causes', () => { ...@@ -193,6 +195,7 @@ describe('instant validation causes', () => {
], ],
}, },
], ],
"code": "E1078",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
...@@ -240,6 +243,7 @@ describe('instant validation causes', () => { ...@@ -240,6 +243,7 @@ describe('instant validation causes', () => {
], ],
}, },
], ],
"code": "E1078",
"description": "Runtime data was accessed outside of <Suspense> "description": "Runtime data was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
......
...@@ -45,6 +45,7 @@ describe('instant validation', () => { ...@@ -45,6 +45,7 @@ describe('instant validation', () => {
await browser.elementByCss('main') await browser.elementByCss('main')
await expect(browser).toDisplayCollapsedRedbox(` await expect(browser).toDisplayCollapsedRedbox(`
{ {
"code": "E1084",
"description": "Data that blocks navigation was accessed outside of <Suspense> "description": "Data that blocks navigation was accessed outside of <Suspense>
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. Uncached data such as fetch(...), cached data with a low expire time, or connection() are all examples of data that only resolve on navigation. This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. Uncached data such as fetch(...), cached data with a low expire time, or connection() are all examples of data that only resolve on navigation.
......
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