From 40d7843df76ec1531870de3abb2d9d32fd8f6281 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Wed, 20 May 2026 10:08:25 +0200 Subject: [PATCH 1/5] Turbopack: fix subpath imports pointing to external packages (#93308) Closes https://github.com/vercel/next.js/issues/93295 Closes #93914 https://nodejs.org/api/packages.html#subpath-exports: > All target paths in the ["exports"](https://nodejs.org/api/packages.html#exports) map (the values associated with export keys) must be relative URL strings starting with `./` but >Unlike the "exports" field, the "imports" field permits mapping to external packages. >The resolution rules for the imports field are otherwise analogous to the exports field. --- .../crates/turbopack-core/src/resolve/mod.rs | 97 ++++++++++--------- .../turbopack-core/src/resolve/remap.rs | 2 +- .../subpath-imports-nested/input/foo.js | 0 .../subpath-imports-nested/input/index.js | 5 + .../input/nested/index.js | 0 .../subpath-imports-nested/input/package.json | 0 .../resolving}/subpath-imports/input/foo.js | 0 .../subpath-imports/input/import.mjs | 0 .../resolving/subpath-imports/input/index.js | 13 +++ .../input/node_modules}/dep/index.js | 0 .../input/node_modules}/dep/package.json | 0 .../subpath-imports/input/package.json | 0 .../resolving}/subpath-imports/input/pat.js | 0 .../subpath-imports/input/require.cjs | 0 .../subpath-imports-nested/input/index.js | 3 - ..._subpath-imports-nested_input_0w09esu._.js | 32 ------ ...path-imports-nested_input_0w09esu._.js.map | 8 -- ...path-imports-nested_input_index_0cpull6.js | 5 - ...-imports-nested_input_index_0cpull6.js.map | 5 - .../imports/subpath-imports/input/index.js | 7 -- ...subpath-imports_input_index_1jr1_4n.js.map | 5 - ...rts_subpath-imports_input_index_1jr1_4n.js | 5 - ...imports_subpath-imports_input_14v1xaq._.js | 59 ----------- ...rts_subpath-imports_input_14v1xaq._.js.map | 11 --- 24 files changed, 70 insertions(+), 187 deletions(-) rename turbopack/crates/turbopack-tests/tests/{snapshot/imports => execution/turbopack/resolving}/subpath-imports-nested/input/foo.js (100%) create mode 100644 turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports-nested/input/index.js rename turbopack/crates/turbopack-tests/tests/{snapshot/imports => execution/turbopack/resolving}/subpath-imports-nested/input/nested/index.js (100%) rename turbopack/crates/turbopack-tests/tests/{snapshot/imports => execution/turbopack/resolving}/subpath-imports-nested/input/package.json (100%) rename turbopack/crates/turbopack-tests/tests/{snapshot/imports => execution/turbopack/resolving}/subpath-imports/input/foo.js (100%) rename turbopack/crates/turbopack-tests/tests/{snapshot/imports => execution/turbopack/resolving}/subpath-imports/input/import.mjs (100%) create mode 100644 turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/index.js rename turbopack/crates/turbopack-tests/tests/{snapshot/imports/subpath-imports/input => execution/turbopack/resolving/subpath-imports/input/node_modules}/dep/index.js (100%) rename turbopack/crates/turbopack-tests/tests/{snapshot/imports/subpath-imports/input => execution/turbopack/resolving/subpath-imports/input/node_modules}/dep/package.json (100%) rename turbopack/crates/turbopack-tests/tests/{snapshot/imports => execution/turbopack/resolving}/subpath-imports/input/package.json (100%) rename turbopack/crates/turbopack-tests/tests/{snapshot/imports => execution/turbopack/resolving}/subpath-imports/input/pat.js (100%) rename turbopack/crates/turbopack-tests/tests/{snapshot/imports => execution/turbopack/resolving}/subpath-imports/input/require.cjs (100%) delete mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/index.js delete mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_0w09esu._.js delete mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_0w09esu._.js.map delete mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/1ece_tests_snapshot_imports_subpath-imports-nested_input_index_0cpull6.js delete mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/1jsg_tests_snapshot_imports_subpath-imports-nested_input_index_0cpull6.js.map delete mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/index.js delete mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports_input_index_1jr1_4n.js.map delete mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/0rv8_turbopack-tests_tests_snapshot_imports_subpath-imports_input_index_1jr1_4n.js delete mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/1do3_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_14v1xaq._.js delete mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/1do3_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_14v1xaq._.js.map diff --git a/turbopack/crates/turbopack-core/src/resolve/mod.rs b/turbopack/crates/turbopack-core/src/resolve/mod.rs index 1ccb41ec100..42745cc4b9a 100644 --- a/turbopack/crates/turbopack-core/src/resolve/mod.rs +++ b/turbopack/crates/turbopack-core/src/resolve/mod.rs @@ -47,7 +47,7 @@ use crate::{ parse::{Request, stringify_data_uri}, pattern::{Pattern, PatternMatch, read_matches}, plugin::{AfterResolvePlugin, AfterResolvePluginCondition, BeforeResolvePlugin}, - remap::{ExportsField, ImportsField, ReplacedSubpathValueResult}, + remap::{ExportImport, ExportsField, ImportsField, ReplacedSubpathValueResult}, }, source::Source, }; @@ -2940,6 +2940,7 @@ async fn resolve_into_package( conditions, unspecified_conditions, query, + ExportImport::Export, ) .await?, ); @@ -3215,6 +3216,7 @@ async fn handle_exports_imports_field( conditions: &BTreeMap, unspecified_conditions: &ConditionValue, query: RcStr, + ty: ExportImport, ) -> Result> { let mut results = Vec::new(); let mut conditions_state = FxHashMap::default(); @@ -3248,57 +3250,59 @@ async fn handle_exports_imports_field( map_key, } in results { - if let Some(result_path) = result_path.with_normalized_path() { - let request = *Request::parse(Pattern::Concatenation(vec![ - Pattern::Constant(rcstr!("./")), - result_path.clone(), - ])) - .to_resolved() - .await?; + let request = match ty { + ExportImport::Export => { + // Only relative paths are allowed in exports fields + Pattern::Concatenation(vec![Pattern::Constant(rcstr!("./")), result_path.clone()]) + } + ExportImport::Import => result_path.clone(), + }; + let request = *Request::parse(request).to_resolved().await?; - let resolve_result = Box::pin(resolve_internal_inline( - package_path.clone(), - request, - options, - )) - .await?; + let resolve_result = Box::pin(resolve_internal_inline( + package_path.clone(), + request, + options, + )) + .await?; - let resolve_result = if let Some(req) = req.as_constant_string() { - resolve_result.with_request(req.clone()) - } else { - match map_key { - AliasKey::Exact => resolve_result.with_request(map_prefix.clone().into()), - AliasKey::Wildcard { .. } => { - // - `req` is the user's request (key of the export map) - // - `result_path` is the final request (value of the export map), so - // effectively `'{foo}*{bar}'` - - // Because of the assertion in AliasMapLookupIterator, `req` is of the - // form: - // - "prefix..." or - // - "prefix......suffix" - - let mut old_request_key = result_path; - // Remove the Pattern::Constant(rcstr!("./")), from above again + let resolve_result = if let Some(req) = req.as_constant_string() { + resolve_result.with_request(req.clone()) + } else { + match map_key { + AliasKey::Exact => resolve_result.with_request(map_prefix.clone().into()), + AliasKey::Wildcard { .. } => { + // - `req` is the user's request (key of the export map) + // - `result_path` is the final request (value of the export map), so + // effectively `'{foo}*{bar}'` + + // Because of the assertion in AliasMapLookupIterator, `req` is of the + // form: + // - "prefix..." or + // - "prefix......suffix" + + let mut old_request_key = result_path; + if matches!(ty, ExportImport::Export) { + // Remove the Pattern::Constant(rcstr!("./")) from above again old_request_key.push_front(rcstr!("./").into()); - let new_request_key = req.clone(); - - resolve_result.with_replaced_request_key_pattern( - Pattern::new(old_request_key), - Pattern::new(new_request_key), - ) } + let new_request_key = req.clone(); + + resolve_result.with_replaced_request_key_pattern( + Pattern::new(old_request_key), + Pattern::new(new_request_key), + ) } - }; + } + }; - let resolve_result = if !conditions.is_empty() { - let resolve_result = resolve_result.await?.with_conditions(&conditions); - resolve_result.cell() - } else { - resolve_result - }; - resolved_results.push(resolve_result); - } + let resolve_result = if !conditions.is_empty() { + let resolve_result = resolve_result.await?.with_conditions(&conditions); + resolve_result.cell() + } else { + resolve_result + }; + resolved_results.push(resolve_result); } // other options do not apply anymore when an exports field exist @@ -3356,6 +3360,7 @@ async fn resolve_package_internal_with_imports_field( conditions, unspecified_conditions, RcStr::default(), + ExportImport::Import, ) .await } diff --git a/turbopack/crates/turbopack-core/src/resolve/remap.rs b/turbopack/crates/turbopack-core/src/resolve/remap.rs index 7d28032dd3f..317f37199af 100644 --- a/turbopack/crates/turbopack-core/src/resolve/remap.rs +++ b/turbopack/crates/turbopack-core/src/resolve/remap.rs @@ -16,7 +16,7 @@ use crate::resolve::{ /// A small helper type to differentiate parsing exports and imports fields. #[derive(Copy, Clone)] -enum ExportImport { +pub(crate) enum ExportImport { Export, Import, } diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/foo.js b/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports-nested/input/foo.js similarity index 100% rename from turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/foo.js rename to turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports-nested/input/foo.js diff --git a/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports-nested/input/index.js b/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports-nested/input/index.js new file mode 100644 index 00000000000..6aae94afa60 --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports-nested/input/index.js @@ -0,0 +1,5 @@ +import foo from './nested' + +it('should resolve nested subpath imports', () => { + expect(foo).toBe('foo') +}) diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/nested/index.js b/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports-nested/input/nested/index.js similarity index 100% rename from turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/nested/index.js rename to turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports-nested/input/nested/index.js diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/package.json b/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports-nested/input/package.json similarity index 100% rename from turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/package.json rename to turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports-nested/input/package.json diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/foo.js b/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/foo.js similarity index 100% rename from turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/foo.js rename to turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/foo.js diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/import.mjs b/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/import.mjs similarity index 100% rename from turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/import.mjs rename to turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/import.mjs diff --git a/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/index.js b/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/index.js new file mode 100644 index 00000000000..8a2ad06b786 --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/index.js @@ -0,0 +1,13 @@ +import foo from '#foo' +import dep from '#dep' +import pattern from '#pattern/pat.js' +import conditionalImport from '#conditional' +const conditionalRequire = require('#conditional') + +it('should resolve subpath imports', () => { + expect(foo).toBe('foo') + expect(dep).toBe('dep') + expect(pattern).toBe('pat') + expect(conditionalImport).toBe('import') + expect(conditionalRequire).toBe('require') +}) diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/dep/index.js b/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/node_modules/dep/index.js similarity index 100% rename from turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/dep/index.js rename to turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/node_modules/dep/index.js diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/dep/package.json b/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/node_modules/dep/package.json similarity index 100% rename from turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/dep/package.json rename to turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/node_modules/dep/package.json diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/package.json b/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/package.json similarity index 100% rename from turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/package.json rename to turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/package.json diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/pat.js b/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/pat.js similarity index 100% rename from turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/pat.js rename to turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/pat.js diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/require.cjs b/turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/require.cjs similarity index 100% rename from turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/require.cjs rename to turbopack/crates/turbopack-tests/tests/execution/turbopack/resolving/subpath-imports/input/require.cjs diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/index.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/index.js deleted file mode 100644 index 301fa979ead..00000000000 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import foo from './nested' - -console.log(foo) diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_0w09esu._.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_0w09esu._.js deleted file mode 100644 index 4dafe4fa12f..00000000000 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_0w09esu._.js +++ /dev/null @@ -1,32 +0,0 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_0w09esu._.js", -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/foo.js [test] (ecmascript)", ((__turbopack_context__) => { -"use strict"; - -__turbopack_context__.s([ - "default", - ()=>__TURBOPACK__default__export__ -]); -const __TURBOPACK__default__export__ = 'foo'; -}), -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/nested/index.js [test] (ecmascript)", ((__turbopack_context__) => { -"use strict"; - -__turbopack_context__.s([ - "default", - ()=>__TURBOPACK__default__export__ -]); -var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$imports$2f$subpath$2d$imports$2d$nested$2f$input$2f$foo$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/foo.js [test] (ecmascript)"); -; -const __TURBOPACK__default__export__ = __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$imports$2f$subpath$2d$imports$2d$nested$2f$input$2f$foo$2e$js__$5b$test$5d$__$28$ecmascript$29$__["default"]; -}), -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { -"use strict"; - -__turbopack_context__.s([]); -var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$imports$2f$subpath$2d$imports$2d$nested$2f$input$2f$nested$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/nested/index.js [test] (ecmascript)"); -; -console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$imports$2f$subpath$2d$imports$2d$nested$2f$input$2f$nested$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__["default"]); -}), -]); - -//# sourceMappingURL=0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_0w09esu._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_0w09esu._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_0w09esu._.js.map deleted file mode 100644 index 0d31271429a..00000000000 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_0w09esu._.js.map +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": 3, - "sources": [], - "sections": [ - {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/foo.js"],"sourcesContent":["export default 'foo'\n"],"names":[],"mappings":";;;;uCAAe"}}, - {"offset": {"line": 13, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/nested/index.js"],"sourcesContent":["import foo from '#foo'\nexport default foo\n"],"names":[],"mappings":";;;;AAAA;;uCACe,8NAAG"}}, - {"offset": {"line": 24, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/index.js"],"sourcesContent":["import foo from './nested'\n\nconsole.log(foo)\n"],"names":["console","log"],"mappings":";AAAA;;AAEAA,QAAQC,GAAG,CAAC,0OAAG"}}] -} \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/1ece_tests_snapshot_imports_subpath-imports-nested_input_index_0cpull6.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/1ece_tests_snapshot_imports_subpath-imports-nested_input_index_0cpull6.js deleted file mode 100644 index 44821258cde..00000000000 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/1ece_tests_snapshot_imports_subpath-imports-nested_input_index_0cpull6.js +++ /dev/null @@ -1,5 +0,0 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push([ - "output/1ece_tests_snapshot_imports_subpath-imports-nested_input_index_0cpull6.js", - {"otherChunks":["output/0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_0w09esu._.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/index.js [test] (ecmascript)"]} -]); -// Dummy runtime \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/1jsg_tests_snapshot_imports_subpath-imports-nested_input_index_0cpull6.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/1jsg_tests_snapshot_imports_subpath-imports-nested_input_index_0cpull6.js.map deleted file mode 100644 index c15d7ec0038..00000000000 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/1jsg_tests_snapshot_imports_subpath-imports-nested_input_index_0cpull6.js.map +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": 3, - "sources": [], - "sections": [] -} \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/index.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/index.js deleted file mode 100644 index 6c71b6f4fc9..00000000000 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import foo from '#foo' -import dep from '#dep' -import pattern from '#pattern/pat.js' -import conditionalImport from '#conditional' -const conditionalRequire = require('#conditional') - -console.log(foo, dep, pattern, conditionalImport, conditionalRequire) diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports_input_index_1jr1_4n.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports_input_index_1jr1_4n.js.map deleted file mode 100644 index c15d7ec0038..00000000000 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/0_9x_turbopack-tests_tests_snapshot_imports_subpath-imports_input_index_1jr1_4n.js.map +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": 3, - "sources": [], - "sections": [] -} \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/0rv8_turbopack-tests_tests_snapshot_imports_subpath-imports_input_index_1jr1_4n.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/0rv8_turbopack-tests_tests_snapshot_imports_subpath-imports_input_index_1jr1_4n.js deleted file mode 100644 index 7721b74569c..00000000000 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/0rv8_turbopack-tests_tests_snapshot_imports_subpath-imports_input_index_1jr1_4n.js +++ /dev/null @@ -1,5 +0,0 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push([ - "output/0rv8_turbopack-tests_tests_snapshot_imports_subpath-imports_input_index_1jr1_4n.js", - {"otherChunks":["output/1do3_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_14v1xaq._.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/index.js [test] (ecmascript)"]} -]); -// Dummy runtime \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/1do3_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_14v1xaq._.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/1do3_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_14v1xaq._.js deleted file mode 100644 index efcac87838b..00000000000 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/1do3_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_14v1xaq._.js +++ /dev/null @@ -1,59 +0,0 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_14v1xaq._.js", -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/foo.js [test] (ecmascript)", ((__turbopack_context__) => { -"use strict"; - -__turbopack_context__.s([ - "default", - ()=>__TURBOPACK__default__export__ -]); -const __TURBOPACK__default__export__ = 'foo'; -}), -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/dep/index.js [test] (ecmascript)", ((__turbopack_context__) => { -"use strict"; - -__turbopack_context__.s([ - "default", - ()=>__TURBOPACK__default__export__ -]); -const __TURBOPACK__default__export__ = 'dep'; -}), -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/pat.js [test] (ecmascript)", ((__turbopack_context__) => { -"use strict"; - -__turbopack_context__.s([ - "default", - ()=>__TURBOPACK__default__export__ -]); -const __TURBOPACK__default__export__ = 'pat'; -}), -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/import.mjs [test] (ecmascript)", ((__turbopack_context__) => { -"use strict"; - -__turbopack_context__.s([ - "default", - ()=>__TURBOPACK__default__export__ -]); -const __TURBOPACK__default__export__ = 'import'; -}), -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/require.cjs [test] (ecmascript)", ((__turbopack_context__, module, exports) => { - -module.exports = 'require'; -}), -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { -"use strict"; - -__turbopack_context__.s([]); -var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$imports$2f$subpath$2d$imports$2f$input$2f$foo$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/foo.js [test] (ecmascript)"); -var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$imports$2f$subpath$2d$imports$2f$input$2f$dep$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/dep/index.js [test] (ecmascript)"); -var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$imports$2f$subpath$2d$imports$2f$input$2f$pat$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/pat.js [test] (ecmascript)"); -var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$imports$2f$subpath$2d$imports$2f$input$2f$import$2e$mjs__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/import.mjs [test] (ecmascript)"); -; -; -; -; -const conditionalRequire = __turbopack_context__.r("[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/require.cjs [test] (ecmascript)"); -console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$imports$2f$subpath$2d$imports$2f$input$2f$foo$2e$js__$5b$test$5d$__$28$ecmascript$29$__["default"], __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$imports$2f$subpath$2d$imports$2f$input$2f$dep$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__["default"], __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$imports$2f$subpath$2d$imports$2f$input$2f$pat$2e$js__$5b$test$5d$__$28$ecmascript$29$__["default"], __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$imports$2f$subpath$2d$imports$2f$input$2f$import$2e$mjs__$5b$test$5d$__$28$ecmascript$29$__["default"], conditionalRequire); -}), -]); - -//# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_14v1xaq._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/1do3_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_14v1xaq._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/1do3_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_14v1xaq._.js.map deleted file mode 100644 index b250641714f..00000000000 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/1do3_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_14v1xaq._.js.map +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": 3, - "sources": [], - "sections": [ - {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/foo.js"],"sourcesContent":["export default 'foo'\n"],"names":[],"mappings":";;;;uCAAe"}}, - {"offset": {"line": 13, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/dep/index.js"],"sourcesContent":["export default 'dep'\n"],"names":[],"mappings":";;;;uCAAe"}}, - {"offset": {"line": 22, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/pat.js"],"sourcesContent":["export default 'pat'\n"],"names":[],"mappings":";;;;uCAAe"}}, - {"offset": {"line": 31, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/import.mjs"],"sourcesContent":["export default 'import'\n"],"names":[],"mappings":";;;;uCAAe"}}, - {"offset": {"line": 39, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/require.cjs"],"sourcesContent":["module.exports = 'require'\n"],"names":["module","exports"],"mappings":"AAAAA,OAAOC,OAAO,GAAG"}}, - {"offset": {"line": 44, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/input/index.js"],"sourcesContent":["import foo from '#foo'\nimport dep from '#dep'\nimport pattern from '#pattern/pat.js'\nimport conditionalImport from '#conditional'\nconst conditionalRequire = require('#conditional')\n\nconsole.log(foo, dep, pattern, conditionalImport, conditionalRequire)\n"],"names":["conditionalRequire","console","log"],"mappings":";AAAA;AACA;AACA;AACA;;;;;AACA,MAAMA;AAENC,QAAQC,GAAG,CAAC,oNAAG,EAAE,6NAAG,EAAE,oNAAO,EAAE,wNAAiB,EAAEF"}}] -} \ No newline at end of file From d46516ce2d4cc3b2c9631909f653560e583e6fbe Mon Sep 17 00:00:00 2001 From: Luke Sandberg Date: Wed, 20 May 2026 02:29:59 -0700 Subject: [PATCH 2/5] Turbopack: fix error reporting with crashing webpack loaders (#93926) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What? When a Turbopack webpack-loader subprocess crashes (e.g. a loader calls `process.exit()`, a native fatal error, or the IPC socket otherwise closes mid-message), the error users see today is: ``` - Execution of ::content failed - Execution of WebpackLoadersProcessedAsset::process failed - Execution of evaluate_webpack_loader failed - failed to receive message - reading packet length - unexpected end of file ``` After this PR, the same crash produces: ``` ⨯ ./data/crash.data Error evaluating Node.js code Error: Node.js subprocess crashed while evaluating loaders [/path/to/loaders/crash-loader.js]: failed to receive message Caused by: - Node.js process exited with exit status: 7 - reading packet length - unexpected end of file Debug info: - failed to receive message - Node.js process exited with exit status: 7 Recent process stderr: - reading packet length - unexpected end of file ``` ### Why? The original message gave no actionable information: no exit code, no captured stdout/stderr, no indication of which loader was running. It also looked like an internal turbopack bug rather than a user-fixable error, and a transient pool failure could cascade into an unrelated "issue formatter crashed while reading the source for a code frame" failure on the way out. ### How? Four orthogonal fixes, plus a regression test: 1. **Capture stdout/stderr on subprocess crash.** `OutputStreamHandler` now keeps a bounded ring buffer (last 100 lines per stream) shared with the owning `NodeJsPoolProcess`. When `NodeJsPoolProcess::recv` fails, the buffers and the child's exit status are attached to the error via `anyhow::Error::context`. 2. **Recover from subprocess crash in `pull_operation`.** Instead of propagating the recv error up through `evaluate_webpack_loader` → `process()` → `Asset::content` (the cascade above), `pull_operation` catches it, synthesizes a `StructuredError` via `evaluate_context.emit_error(...)`, disables process reuse, and returns `Ok(None)`. This mirrors the existing in-band loader-error path, so the asset's existing `FileContent::NotFound` degradation kicks in naturally — `Asset::content` never errors. 3. **Include the loader chain in the error message and issue detail.** `WebpackLoaderContext` gained a `loader_names: Vec` field. A new optional `EvaluateContext::crash_context_prefix()` trait method lets webpack-loader evaluations describe what was being evaluated (\"loaders [a, b, c]\") in the synthesized crash message. `EvaluationIssue` also gained an optional `detail` field for the same chain, surfacing it in `--log-detail` output. PostCSS evaluations are labelled \"postcss\". 4. **Crash-proof the issue formatter.** `PlainSource::from_source` and `IssueSource::into_plain` previously propagated errors from `asset.content()` with `?`. They now degrade to `FileContent::NotFound` (and `range = None`) on read failure, so a future regression in some other code path can never cause the issue reporter itself to crash on top of whatever the user was debugging. ### Tests - Added `test/e2e/app-dir/webpack-loader-errors/loaders/crash-loader.js`: a loader that writes a marker to stderr and calls `process.exit(7)`. - Added an e2e test that fetches `/crash` and asserts the marker, the absence of the internal cascade, the loader name, and the resource name are all present in the CLI output. - All 11 tests in `webpack-loader-errors.test.ts` pass; the 5 Rust `turbopack-node` pool tests still pass. Some snapshot/golden tests for error formatting may need updating in CI since `EvaluationIssue` now emits a non-empty `detail`. --- .../webpack-loader-errors/app/crash/page.tsx | 5 ++ .../webpack-loader-errors/data/crash.data | 1 + .../loaders/crash-loader.js | 4 + .../webpack-loader-errors/next.config.js | 8 ++ .../webpack-loader-errors.test.ts | 25 ++++++ .../crates/turbopack-core/src/issue/mod.rs | 26 ++++-- .../crates/turbopack-node/src/evaluate.rs | 47 +++++++++- .../turbopack-node/src/process_pool/mod.rs | 89 ++++++++++++++++++- .../turbopack-node/src/source_map/mod.rs | 13 +++ .../turbopack-node/src/transforms/postcss.rs | 64 +++++++------ .../turbopack-node/src/transforms/webpack.rs | 35 ++++++++ 11 files changed, 271 insertions(+), 46 deletions(-) create mode 100644 test/e2e/app-dir/webpack-loader-errors/app/crash/page.tsx create mode 100644 test/e2e/app-dir/webpack-loader-errors/data/crash.data create mode 100644 test/e2e/app-dir/webpack-loader-errors/loaders/crash-loader.js diff --git a/test/e2e/app-dir/webpack-loader-errors/app/crash/page.tsx b/test/e2e/app-dir/webpack-loader-errors/app/crash/page.tsx new file mode 100644 index 00000000000..254a9154b69 --- /dev/null +++ b/test/e2e/app-dir/webpack-loader-errors/app/crash/page.tsx @@ -0,0 +1,5 @@ +const data = require('../../data/crash.data') + +export default function Page() { + return

{data.default}

+} diff --git a/test/e2e/app-dir/webpack-loader-errors/data/crash.data b/test/e2e/app-dir/webpack-loader-errors/data/crash.data new file mode 100644 index 00000000000..b669f0f5cc6 --- /dev/null +++ b/test/e2e/app-dir/webpack-loader-errors/data/crash.data @@ -0,0 +1 @@ +export default "crash-data" diff --git a/test/e2e/app-dir/webpack-loader-errors/loaders/crash-loader.js b/test/e2e/app-dir/webpack-loader-errors/loaders/crash-loader.js new file mode 100644 index 00000000000..8047564761a --- /dev/null +++ b/test/e2e/app-dir/webpack-loader-errors/loaders/crash-loader.js @@ -0,0 +1,4 @@ +module.exports = function crashLoader() { + process.stderr.write('TURBOPACK_CRASH_LOADER_STDERR_MARKER\n') + process.exit(7) +} diff --git a/test/e2e/app-dir/webpack-loader-errors/next.config.js b/test/e2e/app-dir/webpack-loader-errors/next.config.js index ef11187932b..918d3d55d60 100644 --- a/test/e2e/app-dir/webpack-loader-errors/next.config.js +++ b/test/e2e/app-dir/webpack-loader-errors/next.config.js @@ -28,6 +28,10 @@ const nextConfig = { loaders: [require.resolve('./loaders/fs-error-loader.js')], as: '*.js', }, + 'crash.data': { + loaders: [require.resolve('./loaders/crash-loader.js')], + as: '*.js', + }, }, }, webpack(config) { @@ -55,6 +59,10 @@ const nextConfig = { { test: /fs-error\.data$/, use: [require.resolve('./loaders/fs-error-loader.js')], + }, + { + test: /crash\.data$/, + use: [require.resolve('./loaders/crash-loader.js')], } ) return config diff --git a/test/e2e/app-dir/webpack-loader-errors/webpack-loader-errors.test.ts b/test/e2e/app-dir/webpack-loader-errors/webpack-loader-errors.test.ts index cccf8455fd5..7821eff20d9 100644 --- a/test/e2e/app-dir/webpack-loader-errors/webpack-loader-errors.test.ts +++ b/test/e2e/app-dir/webpack-loader-errors/webpack-loader-errors.test.ts @@ -88,6 +88,31 @@ describe('webpack-loader-errors', () => { expect(output).toMatch(/\(from .+loaders\/fs-error-loader/) }) }) + + // Turbopack-only: webpack runs loaders in-process, so a loader calling + // process.exit() would kill the dev server itself. In Turbopack the + // loader runs in a Node.js subprocess from a worker pool; a hard + // process exit closes the IPC socket mid-message. This used to surface + // as an opaque "failed to receive message / unexpected end of file" + // cascade with no diagnostic context. + it('should surface a useful error when a loader crashes the Node.js subprocess', async () => { + await next.fetch('/crash') + await retry(async () => { + const output = stripAnsi(next.cliOutput) + // The crashing loader wrote to stderr before exiting. With the + // fix, that output is captured and attached to the error. + expect(output).toContain('TURBOPACK_CRASH_LOADER_STDERR_MARKER') + // The crash should not surface as the raw internal cascade. + expect(output).not.toContain( + '::content failed' + ) + // The synthesized error should reference both the crashing + // resource and the loader that was running, so the user knows + // exactly which loader to look at. + expect(output).toContain('crash.data') + expect(output).toMatch(/loaders \[[^\]]*loaders\/crash-loader/) + }, 30_000) + }) } }) diff --git a/turbopack/crates/turbopack-core/src/issue/mod.rs b/turbopack/crates/turbopack-core/src/issue/mod.rs index 744af9e89cd..fac44de3b6e 100644 --- a/turbopack/crates/turbopack-core/src/issue/mod.rs +++ b/turbopack/crates/turbopack-core/src/issue/mod.rs @@ -497,7 +497,12 @@ impl IssueSource { let mut range = match range { SourceRange::LineColumn(start, end) => Some((start, end)), SourceRange::ByteOffset(start, end) => { - if let FileLinesContent::Lines(lines) = &*self.source.content().lines().await? { + // Defensively read the content, an error there should not prevent all issue + // formatting. Best practice is for `content` to return `NotFound` instead of + // an error. + if let Ok(content) = self.source.content().lines().await + && let FileLinesContent::Lines(lines) = &*content + { let start = find_line_and_column(lines.as_ref(), start); let end = find_line_and_column(lines.as_ref(), end); Some((start, end)) @@ -1034,15 +1039,22 @@ pub struct PlainSource { impl PlainSource { #[turbo_tasks::function] pub async fn from_source(asset: ResolvedVc>) -> Result> { - let asset_content = asset.content().await?; - let content = match *asset_content { - AssetContent::File(file_content) => file_content.await?, - AssetContent::Redirect { .. } => ReadRef::new_owned(FileContent::NotFound), + // Defensively read the content, an error there should not prevent all issue + // formatting. Best practice is for `content` to return `NotFound` instead of + // an error. + let content = if let Ok(asset_content) = asset.content().await + && let AssetContent::File(file_content) = &*asset_content + && let Ok(file_content) = file_content.await + { + file_content + } else { + ReadRef::new_owned(FileContent::NotFound) }; + let ident = asset.ident(); Ok(PlainSource { - ident: asset.ident().to_string().owned().await?, - file_path: asset.ident().await?.path.to_string_ref().await?, + ident: ident.to_string().owned().await?, + file_path: ident.await?.path.to_string_ref().await?, content, } .cell()) diff --git a/turbopack/crates/turbopack-node/src/evaluate.rs b/turbopack/crates/turbopack-node/src/evaluate.rs index 2258121301f..2c81f6105d1 100644 --- a/turbopack/crates/turbopack-node/src/evaluate.rs +++ b/turbopack/crates/turbopack-node/src/evaluate.rs @@ -352,6 +352,15 @@ pub trait EvaluateContext { state: Self::State, pool: &EvaluatePool, ) -> impl Future> + Send; + + /// Optional human-readable prefix describing *what was being evaluated*, + /// included verbatim in the message of the synthetic [`StructuredError`] + /// emitted when the Node.js subprocess crashes mid-evaluation. For + /// webpack-loader evaluations this is the loader chain ("loaders + /// [foo, bar]"). The default returns `None`. + fn crash_context_prefix(&self) -> Option { + None + } } pub async fn custom_evaluate(evaluate_context: impl EvaluateContext) -> Result>> { @@ -546,7 +555,34 @@ async fn pull_operation( let _guard = duration_span!("Node.js evaluation"); loop { - let message = serde_json::from_slice(&operation.recv().await?)?; + let recv_result = operation.recv().await; + let bytes = match recv_result { + Ok(bytes) => bytes, + Err(err) => { + // The Node.js subprocess crashed (or some other IPC failure + // closed the connection) before sending a response. Convert + // this into a synthesized issue with whatever diagnostic + // context the pool managed to capture, so the user sees a + // real error message instead of an internal turbo-tasks + // execution-failed cascade. + let message = match evaluate_context.crash_context_prefix() { + Some(prefix) => format!( + "Node.js subprocess crashed while evaluating {}: {}", + prefix, + PrettyPrintError(&err) + ), + None => format!( + "Node.js subprocess crashed while evaluating: {}", + PrettyPrintError(&err) + ), + }; + let synthetic = StructuredError::from_message("Error".to_string(), message); + evaluate_context.emit_error(synthetic, pool).await?; + operation.disallow_reuse(); + return Ok(None); + } + }; + let message = serde_json::from_slice(&bytes)?; match message { EvalJavaScriptIncomingMessage::Error(error) => { @@ -647,6 +683,7 @@ impl EvaluateContext for BasicEvaluateContext { assets_for_source_mapping: pool.assets_for_source_mapping, assets_root: pool.assets_root.clone(), root_path: self.chunking_context.root_path().owned().await?, + detail: None, } .resolved_cell() .emit(); @@ -684,6 +721,10 @@ pub struct EvaluationIssue { pub assets_for_source_mapping: ResolvedVc, pub assets_root: FileSystemPath, pub root_path: FileSystemPath, + /// Optional extra context shown only when log details are enabled — e.g. + /// the loader chain that was running when a webpack-loader subprocess + /// errored. + pub detail: Option, } #[async_trait] @@ -715,6 +756,10 @@ impl Issue for EvaluationIssue { ))) } + async fn detail(&self) -> Result> { + Ok(self.detail.clone().map(StyledString::Text)) + } + fn source(&self) -> Option { Some(self.source) } diff --git a/turbopack/crates/turbopack-node/src/process_pool/mod.rs b/turbopack/crates/turbopack-node/src/process_pool/mod.rs index 1c3819ae414..abde3bf788c 100644 --- a/turbopack/crates/turbopack-node/src/process_pool/mod.rs +++ b/turbopack/crates/turbopack-node/src/process_pool/mod.rs @@ -1,4 +1,5 @@ use std::{ + collections::VecDeque, future::Future, mem::take, path::{Path, PathBuf}, @@ -46,6 +47,11 @@ struct NodeJsPoolProcess { connection: TcpStream, stdout_handler: OutputStreamHandler, stderr_handler: OutputStreamHandler, + /// Shared ring buffer of recent stdout lines; lives independently of + /// `stdout_handler` so the post-mortem on a recv failure can still read + /// it after the handler future has returned an error. + recent_stdout: RecentLines, + recent_stderr: RecentLines, debug: bool, cpu_time_invested: Duration, } @@ -91,6 +97,17 @@ static GLOBAL_OUTPUT_LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_ne static MARKER: &[u8] = b"TURBOPACK_OUTPUT_"; static MARKER_STR: &str = "TURBOPACK_OUTPUT_"; +/// Maximum number of recent output lines retained per stream for diagnostic +/// purposes — included in the error message when the subprocess crashes +/// before completing a recv. +const RECENT_OUTPUT_LINES: usize = 100; + +/// A bounded ring buffer of recent lines from a child stream. Shared with the +/// owning [`NodeJsPoolProcess`] so that the post-mortem code on a recv failure +/// can read what the child wrote even if the handler future has already +/// returned an error (and dropped its local state). +type RecentLines = Arc>>>; + struct OutputStreamHandler { stream: BufReader, shared: SharedOutputSet, @@ -98,6 +115,7 @@ struct OutputStreamHandler { root: FileSystemPath, project_dir: FileSystemPath, final_stream: W, + recent_lines: RecentLines, } impl OutputStreamHandler { @@ -113,6 +131,7 @@ impl OutputStreamHandler { root, project_dir, final_stream, + recent_lines, } = self; async fn write_final( @@ -183,9 +202,17 @@ impl OutputStreamHandler { { bail!("stream closed unexpectedly") } - if buffer.len() - start == MARKER.len() + 2 - && &buffer[start..buffer.len() - 2] == MARKER - { + // Mirror the just-read line into the recent-lines ring buffer for + // diagnostic capture on subprocess crash. Skip protocol markers. + let line_is_marker = buffer.len() - start == MARKER.len() + 2 + && &buffer[start..buffer.len() - 2] == MARKER; + if !line_is_marker { + let mut lines = recent_lines.lock(); + if lines.len() >= RECENT_OUTPUT_LINES { + lines.pop_front(); + } + lines.push_back(buffer[start..].to_vec()); + } else { // This is new line buffer.pop(); // This is the type @@ -373,6 +400,11 @@ impl NodeJsPoolProcess { let child_stdout = BufReader::new(child.stdout.take().unwrap()); let child_stderr = BufReader::new(child.stderr.take().unwrap()); + let recent_stdout: RecentLines = + Arc::new(Mutex::new(VecDeque::with_capacity(RECENT_OUTPUT_LINES))); + let recent_stderr: RecentLines = + Arc::new(Mutex::new(VecDeque::with_capacity(RECENT_OUTPUT_LINES))); + let stdout_handler = OutputStreamHandler { stream: child_stdout, shared: shared_stdout, @@ -380,6 +412,7 @@ impl NodeJsPoolProcess { root: assets_root.clone(), project_dir: project_dir.clone(), final_stream: stdout(), + recent_lines: recent_stdout.clone(), }; let stderr_handler = OutputStreamHandler { stream: child_stderr, @@ -388,6 +421,7 @@ impl NodeJsPoolProcess { root: assets_root.clone(), project_dir: project_dir.clone(), final_stream: stderr(), + recent_lines: recent_stderr.clone(), }; let mut process = Self { @@ -395,6 +429,8 @@ impl NodeJsPoolProcess { connection, stdout_handler, stderr_handler, + recent_stdout, + recent_stderr, debug, cpu_time_invested: Duration::ZERO, }; @@ -455,11 +491,56 @@ impl NodeJsPoolProcess { self.stdout_handler.handle_operation(), self.stderr_handler.handle_operation(), ); - let result: Bytes = result?; + let result = match result { + Err(err) => { + // The IPC read failed — the most common cause is the child + // process crashing or exiting before sending a response. + // Attach whatever output the child wrote (recent lines from + // both stream handlers + the child's exit status, if + // available) so the user sees something diagnostic instead + // of an opaque "unexpected end of file" cascade. + return Err(self.diagnostic_recv_error(err).await); + } + Ok(result) => result, + }; stdout.context("unable to handle stdout from the Node.js process in a structured way")?; stderr.context("unable to handle stderr from the Node.js process in a structured way")?; Ok(result) } + + /// Build a contextualized error for a failed [`Self::recv`]. Includes + /// the captured stdout/stderr ring buffers and, if the child has + /// terminated, its exit status. + async fn diagnostic_recv_error(&mut self, err: anyhow::Error) -> anyhow::Error { + let exit_status = match self.child.as_mut() { + Some(child) => match timeout(Duration::from_secs(2), child.wait()).await { + Ok(Ok(status)) => Some(status), + _ => None, + }, + None => None, + }; + let mut output = String::new(); + let stdout_lines: Vec> = self.recent_stdout.lock().iter().cloned().collect(); + let stderr_lines: Vec> = self.recent_stderr.lock().iter().cloned().collect(); + if !stdout_lines.is_empty() { + output.push_str("\nRecent process stdout:\n"); + for line in stdout_lines { + output.push_str(&String::from_utf8_lossy(&line)); + } + } + if !stderr_lines.is_empty() { + output.push_str("\nRecent process stderr:\n"); + for line in stderr_lines { + output.push_str(&String::from_utf8_lossy(&line)); + } + } + let exit_note = match exit_status { + Some(status) => format!("Node.js process exited with {status}"), + None => "Node.js process is still running or its exit status is unavailable".into(), + }; + // ast-grep-ignore: no-context-format + err.context(format!("{exit_note}{output}")) + } async fn send(&mut self, packet_data: Bytes) -> Result<()> { self.connection .write_u32( diff --git a/turbopack/crates/turbopack-node/src/source_map/mod.rs b/turbopack/crates/turbopack-node/src/source_map/mod.rs index aed3e5085cf..4c151b7c80f 100644 --- a/turbopack/crates/turbopack-node/src/source_map/mod.rs +++ b/turbopack/crates/turbopack-node/src/source_map/mod.rs @@ -275,6 +275,19 @@ pub struct StructuredError { } impl StructuredError { + /// Construct a [`StructuredError`] from a free-form message with no stack + /// frames or cause. Used when synthesizing an error from contexts that do + /// not have a real JavaScript stack trace, such as a Node.js subprocess + /// crash before any response was received. + pub fn from_message(name: String, message: String) -> Self { + Self { + name, + message, + stack: Vec::new(), + cause: None, + } + } + pub async fn print( &self, assets_for_source_mapping: Vc, diff --git a/turbopack/crates/turbopack-node/src/transforms/postcss.rs b/turbopack/crates/turbopack-node/src/transforms/postcss.rs index 289d3942b0f..aad16fd1a63 100644 --- a/turbopack/crates/turbopack-node/src/transforms/postcss.rs +++ b/turbopack/crates/turbopack-node/src/transforms/postcss.rs @@ -84,40 +84,35 @@ pub struct PostCssTransformOptions { #[turbo_tasks::function] fn postcss_configs() -> Vc> { - Vc::cell( - [ - ".postcssrc", - ".postcssrc.json", - ".postcssrc.yaml", - ".postcssrc.yml", - ".postcssrc.js", - ".postcssrc.mjs", - ".postcssrc.cjs", - ".postcssrc.ts", - ".postcssrc.mts", - ".postcssrc.cts", - ".config/postcssrc", - ".config/postcssrc.json", - ".config/postcssrc.yaml", - ".config/postcssrc.yml", - ".config/postcssrc.js", - ".config/postcssrc.mjs", - ".config/postcssrc.cjs", - ".config/postcssrc.ts", - ".config/postcssrc.mts", - ".config/postcssrc.cts", - "postcss.config.js", - "postcss.config.mjs", - "postcss.config.cjs", - "postcss.config.ts", - "postcss.config.mts", - "postcss.config.cts", - "postcss.config.json", - ] - .into_iter() - .map(RcStr::from) - .collect(), - ) + Vc::cell(vec![ + rcstr!(".postcssrc"), + rcstr!(".postcssrc.json"), + rcstr!(".postcssrc.yaml"), + rcstr!(".postcssrc.yml"), + rcstr!(".postcssrc.js"), + rcstr!(".postcssrc.mjs"), + rcstr!(".postcssrc.cjs"), + rcstr!(".postcssrc.ts"), + rcstr!(".postcssrc.mts"), + rcstr!(".postcssrc.cts"), + rcstr!(".config/postcssrc"), + rcstr!(".config/postcssrc.json"), + rcstr!(".config/postcssrc.yaml"), + rcstr!(".config/postcssrc.yml"), + rcstr!(".config/postcssrc.js"), + rcstr!(".config/postcssrc.mjs"), + rcstr!(".config/postcssrc.cjs"), + rcstr!(".config/postcssrc.ts"), + rcstr!(".config/postcssrc.mts"), + rcstr!(".config/postcssrc.cts"), + rcstr!("postcss.config.js"), + rcstr!("postcss.config.mjs"), + rcstr!("postcss.config.cjs"), + rcstr!("postcss.config.ts"), + rcstr!("postcss.config.mts"), + rcstr!("postcss.config.cts"), + rcstr!("postcss.config.json"), + ]) } #[turbo_tasks::value] @@ -588,6 +583,7 @@ impl PostCssTransformedAsset { ResolvedVc::cell(source_map.into()), ], additional_invalidation: config_changed, + loader_names: vec![turbo_rcstr::rcstr!("postcss")], }) .await?; diff --git a/turbopack/crates/turbopack-node/src/transforms/webpack.rs b/turbopack/crates/turbopack-node/src/transforms/webpack.rs index 5dbee39c265..498fecbd3f2 100644 --- a/turbopack/crates/turbopack-node/src/transforms/webpack.rs +++ b/turbopack/crates/turbopack-node/src/transforms/webpack.rs @@ -300,6 +300,7 @@ impl WebpackLoadersProcessedAsset { project_path ); }; + let loader_names: Vec = loaders.iter().map(|l| l.loader.clone()).collect(); let config_value = evaluate_webpack_loader(WebpackLoaderContext { entries, cwd: project_path.clone(), @@ -320,6 +321,7 @@ impl WebpackLoadersProcessedAsset { ResolvedVc::cell(transform.source_maps.into()), ], additional_invalidation: Completion::immutable().to_resolved().await?, + loader_names, }) .await?; @@ -507,6 +509,34 @@ pub struct WebpackLoaderContext { pub asset_context: ResolvedVc>, pub args: Vec>, pub additional_invalidation: ResolvedVc, + /// Names of the loaders being applied to the source, in pipeline order. + /// Used to enrich error messages and issue details so users know which + /// loader chain was running when an error occurred. + pub loader_names: Vec, +} + +impl WebpackLoaderContext { + /// Format the loader chain as "loaders [a, b, c]" for inclusion in + /// error messages and issue detail text. Returns `None` if there are + /// no loaders, which should not normally happen but keeps the helper + /// well-defined. + fn loader_chain_description(&self) -> Option { + if self.loader_names.is_empty() { + None + } else { + Some( + format!( + "loaders [{}]", + self.loader_names + .iter() + .map(|n| n.as_str()) + .collect::>() + .join(", ") + ) + .into(), + ) + } + } } impl EvaluateContext for WebpackLoaderContext { @@ -544,6 +574,10 @@ impl EvaluateContext for WebpackLoaderContext { true } + fn crash_context_prefix(&self) -> Option { + self.loader_chain_description() + } + async fn emit_error(&self, error: StructuredError, pool: &EvaluatePool) -> Result<()> { EvaluationIssue { error, @@ -551,6 +585,7 @@ impl EvaluateContext for WebpackLoaderContext { assets_for_source_mapping: pool.assets_for_source_mapping, assets_root: pool.assets_root.clone(), root_path: self.chunking_context.root_path().owned().await?, + detail: self.loader_chain_description(), } .resolved_cell() .emit(); From 797d0060df98fc8e058f45b8690fdb92e9ee857e Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Wed, 20 May 2026 11:48:50 +0200 Subject: [PATCH 3/5] docs: instrumentationClientInject (#93913) Add docs for https://github.com/vercel/next.js/pull/93785 --- .../instrumentation-client.mdx | 4 ++ .../instrumentationClientInject.mdx | 68 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 docs/01-app/03-api-reference/05-config/01-next-config-js/instrumentationClientInject.mdx diff --git a/docs/01-app/03-api-reference/03-file-conventions/instrumentation-client.mdx b/docs/01-app/03-api-reference/03-file-conventions/instrumentation-client.mdx index 71220570bc6..92828446e2d 100644 --- a/docs/01-app/03-api-reference/03-file-conventions/instrumentation-client.mdx +++ b/docs/01-app/03-api-reference/03-file-conventions/instrumentation-client.mdx @@ -87,6 +87,10 @@ The `instrumentation-client.js` file executes at a specific point in the applica This timing makes it ideal for setting up error tracking, analytics, and performance monitoring that needs to capture early application lifecycle events. +## See also + +`next.config.js` plugins (for example, wrappers like `withSentry`) can register their own client instrumentation module via the [`instrumentationClientInject`](/docs/app/api-reference/config/next-config-js/instrumentationClientInject) option. Injected modules run before this file, in array order, and may export their own `onRouterTransitionStart`. Application code should continue to use this file convention directly. + ## Examples ### Error tracking diff --git a/docs/01-app/03-api-reference/05-config/01-next-config-js/instrumentationClientInject.mdx b/docs/01-app/03-api-reference/05-config/01-next-config-js/instrumentationClientInject.mdx new file mode 100644 index 00000000000..241ee9a05f4 --- /dev/null +++ b/docs/01-app/03-api-reference/05-config/01-next-config-js/instrumentationClientInject.mdx @@ -0,0 +1,68 @@ +--- +title: instrumentationClientInject +description: Inject additional client-side instrumentation modules before the user's `instrumentation-client.{js,ts}` file. +--- + +`instrumentationClientInject` is a list of modules that are imported on the client for their side effects before the user's [`instrumentation-client.{js,ts}`](/docs/app/api-reference/file-conventions/instrumentation-client) file runs, ahead of React hydration. + +This option is primarily intended for **`next.config.js` plugins** (for example, wrappers like `withSentry` or `withAnalytics` that extend a project's config). It lets such a plugin inject its own client instrumentation module — including a navigation hook — without requiring every project to author or modify an `instrumentation-client` file. Application code should generally continue to use the [`instrumentation-client.{js,ts}`](/docs/app/api-reference/file-conventions/instrumentation-client) file convention directly. + +A plugin typically appends its own module to whatever the project already has configured: + +```js filename="withMyInstrumentation.js" +module.exports = function withMyInstrumentation(nextConfig = {}) { + return { + ...nextConfig, + instrumentationClientInject: [ + ...(nextConfig.instrumentationClientInject ?? []), + 'my-instrumentation-package/client', + ], + } +} +``` + +It can also be set directly: + +```js filename="next.config.js" +/** @type {import('next').NextConfig} */ +module.exports = { + instrumentationClientInject: [ + 'my-analytics-package', + './lib/sentry-client.js', + ], +} +``` + +Each entry is one of: + +- A bare npm package name, resolved from the project's `node_modules`. +- A path relative to the project root. + +## Execution order + +Modules run on the client in this order: + +1. Each entry in `instrumentationClientInject`, in array order. +2. The project's `instrumentation-client.{js,ts}` file, if present. +3. React hydration. + +## Router navigation hook + +Each injected module may optionally export an `onRouterTransitionStart` function with the same signature as the one documented for the [`instrumentation-client` file convention](/docs/app/api-reference/file-conventions/instrumentation-client#router-navigation-tracking). Next.js composes a single hook that fans out to every exported `onRouterTransitionStart` on each navigation, calling them in array order, with the user file's hook running last. + +```js filename="lib/sentry-client.js" +// Side-effectful setup runs at load time. +setupSentry() + +export function onRouterTransitionStart(url, navigationType) { + recordNavigationBreadcrumb(url, navigationType) +} +``` + +Modules that do not export `onRouterTransitionStart` are skipped during navigation. + +## Version history + +| Version | Changes | +| --------- | ---------------------------------------- | +| `v16.3.0` | `instrumentationClientInject` introduced | From d13adce31f763f14ab7077097543abcaac96b921 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Wed, 20 May 2026 12:24:02 +0200 Subject: [PATCH 4/5] Fix Yarn berry tests (#93962) 4.15 made [npmMinimalAgeGate: 1d the default](https://github.com/yarnpkg/berry/pull/7135) 1. Pin yarn version to prevent random breakages in the future 2. Add trusted packages to ignore npmMinimalAgeGate for them https://github.com/yarnpkg/berry/releases/tag/%40yarnpkg%2Fcli%2F4.15.0 --- test/e2e/yarn-pnp/test/utils.ts | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/test/e2e/yarn-pnp/test/utils.ts b/test/e2e/yarn-pnp/test/utils.ts index 170b4cfc12b..84bbb4fb4de 100644 --- a/test/e2e/yarn-pnp/test/utils.ts +++ b/test/e2e/yarn-pnp/test/utils.ts @@ -55,9 +55,29 @@ export function runTests( prev.push(`${cur}@${dependencies[cur]}`) return prev }, [] as string[]) - return `yarn set version berry && yarn config set enableGlobalCache true && yarn config set compressionLevel 0 && yarn add ${pkgs.join( - ' ' - )}` + const minimumReleaseAgeExclude = JSON.stringify( + JSON.stringify([ + '@next/*', + '@turbo/*', + '@vercel/*', + '@workflow/*', + 'babel-plugin-react-compiler', + 'next', + 'react', + 'react-dom', + 'react-is', + 'react-server-dom-*', + 'scheduler', + 'turbo', + ]) + ) + return [ + `yarn set version 4.15.0`, + `yarn config set enableGlobalCache true`, + `yarn config set compressionLevel 0`, + `yarn config set npmPreapprovedPackages --json ${minimumReleaseAgeExclude}`, + `yarn add ${pkgs.join(' ')}`, + ].join(' && ') }, buildCommand: `yarn next build`, startCommand: (global as any).isNextDev ? `yarn next` : `yarn next start`, From 4e3eb5137ec81905584fa0f2943d501d5aea1f18 Mon Sep 17 00:00:00 2001 From: Aurora Scharff <66901228+aurorascharff@users.noreply.github.com> Date: Wed, 20 May 2026 13:23:57 +0200 Subject: [PATCH 5/5] Polish instant fix cards and validation messages (#93894) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What? - Rename cards to plain English: `Prerender params if known`, `Mark the route as dynamic`, `For telemetry, use a timing API`. - Remove `Wrap body in Suspense` card from viewport variants. - Body errors: `during the initial render` → `during prerendering`; `blocking navigation` → `blocking the page load`. - Server sync IO leads with `the unstable value `. - Client sync IO drops `fixed at build time`. - New loading-state icon for the `block` group. ### Demo - [Fix Overview](https://error-messages-overhaul-ibsl.labs.vercel.dev/fix-overview) --------- Co-authored-by: Cursor --- packages/next/errors.json | 33 +- .../components/errors/dialog/dialog.tsx | 1 + .../instant/instant-guidance-data.ts | 48 +- .../components/instant/instant-guidance.tsx | 22 +- .../dev-overlay/container/errors.tsx | 16 +- .../dev-overlay/icons/fix-card-icons.tsx | 25 +- .../app-render/blocking-route-messages.ts | 25 +- .../src/server/app-render/sync-io-messages.ts | 9 +- .../cache-components-dev-cache-scope.test.ts | 4 +- .../cache-components-dev-errors.test.ts | 12 +- ...components-dev-fallback-validation.test.ts | 72 +- .../cache-components-errors.test.ts | 616 +++++++++--------- .../instant-validation-build.test.ts | 2 +- .../instant-validation-causes.test.ts | 8 +- .../instant-validation-level-error.test.ts | 18 +- ...tant-validation-level-manual-error.test.ts | 10 +- ...nt-validation-level-manual-warning.test.ts | 48 +- .../instant-validation-level-warning.test.ts | 12 +- .../instant-validation-static-shells.test.ts | 6 +- .../instant-validation-parallel-slots.test.ts | 48 +- .../instant-validation.test.ts | 227 ++++--- .../build-output-prerender.test.ts | 24 +- 22 files changed, 652 insertions(+), 634 deletions(-) diff --git a/packages/next/errors.json b/packages/next/errors.json index e771e451a2a..cfc81bdc006 100644 --- a/packages/next/errors.json +++ b/packages/next/errors.json @@ -1250,10 +1250,31 @@ "1249": "Route \"%s\": Next.js encountered uncached data during the initial render or a navigation.\\n\\n\\`fetch(...)\\` or \\`connection()\\` accessed outside of \\`\\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\\n\\nWays to fix this:\\n - Cache the data access with \\`\"use cache\"\\`\\n - Provide a placeholder with \\`\\` around the data access\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", "1250": "Route \"%s\": Next.js encountered runtime data during the initial render or a navigation.\\n\\n\\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` accessed outside of \\`\\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\\n\\nWays to fix this:\\n - Use \\`generateStaticParams\\` to make route params static\\n - Provide a placeholder with \\`\\` around the data access\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", "1251": "Route \"%s\": Next.js encountered runtime data during the initial render or a navigation.\\n\\n\\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` accessed outside of \\`\\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\\n\\nWays to fix this:\\n - Provide a placeholder with \\`\\` around the data access\\n - Use \\`generateStaticParams\\` to make route params static\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", - "1252": "\\`experimental.cssChunking: \"graph\"\\` is only supported with Turbopack. Please remove the option or run Next.js with Turbopack in %s.", - "1253": "\\`experimental.cssChunking: \"strict\"\\` is only supported with webpack. Please remove the option or run Next.js with webpack in %s.", - "1254": "\\`experimental.cssChunking: false\\` is only supported with webpack. Please remove the option or run Next.js with webpack in %s.", - "1255": "Compilation failed but no issues were recorded", - "1256": "no route matched for path \"%s\"", - "1257": "compileRoute: either routeSpecifier or path is required" + "1252": "Route \"%s\": Next.js encountered runtime data in \\`generateViewport()\\`.\\n\\n\\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` in \\`generateViewport()\\` prevents the page from being prerendered, leading to a slower user experience.\\n\\nWays to fix this:\\n - Use a static viewport export instead of \\`generateViewport()\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport", + "1253": "Route \"%s\": Next.js encountered uncached or runtime data in \\`generateViewport()\\`.\\n\\nThis prevents the page from being prerendered, leading to a slower user experience.\\n\\nWays to fix this:\\n - Use a static viewport export instead of \\`generateViewport()\\`\\n - Cache the viewport data with \\`\"use cache\"\\` in \\`generateViewport()\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport", + "1254": "Route \"%s\": Next.js encountered uncached or runtime data during the initial render.\\n\\n\\`fetch(...)\\`, \\`cookies()\\`, \\`headers()\\`, \\`params\\`, \\`searchParams\\`, or \\`connection()\\` accessed outside of \\`\\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience.\\n\\nWays to fix this:\\n - Cache the data access with \\`\"use cache\"\\`\\n - Provide a placeholder with \\`\\` around the data access\\n - If params are known, prerender them with \\`generateStaticParams\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", + "1255": "Route \"%s\": Next.js encountered uncached data in \\`generateViewport()\\`.\\n\\n\\`fetch(...)\\` or \\`connection()\\` in \\`generateViewport()\\` prevents the page from being prerendered, leading to a slower user experience.\\n\\nWays to fix this:\\n - Cache the viewport data with \\`\"use cache\"\\` in \\`generateViewport()\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport", + "1256": "Route \"%s\": Next.js encountered %s in a Client Component.\\n\\nThis value would be evaluated during the prerender, instead of recomputed on each visit.\\n\\nWays to fix this:\\n - Wrap the Client Component in \\`\\`\\n - Move the read into a \\`useEffect\\` or event handler\\n%s\\nLearn more: %s", + "1257": "Route \"%s\": Next.js encountered runtime data during the initial render.\\n\\n\\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` accessed outside of \\`\\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience.\\n\\nWays to fix this:\\n - Provide a placeholder with \\`\\` around the data access\\n - If params are known, prerender them with \\`generateStaticParams\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", + "1258": "Route \"%s\": Next.js encountered runtime data during the initial render or a navigation.\\n\\n\\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` accessed outside of \\`\\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\\n\\nWays to fix this:\\n - Provide a placeholder with \\`\\` around the data access\\n - If params are known, prerender them with \\`generateStaticParams\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", + "1259": "Route \"%s\": Next.js encountered %s while prerendering.\\n\\nThis value can change between renders, so it must be either prerendered or computed later.\\n\\nWays to fix this:\\n - Render at request time by adding a dynamic data access (e.g. \\`await connection()\\`) before this call\\n - Prerender and cache the value with \\`\"use cache\"\\`\\n - Render the value on the client with \\`\"use client\"\\`\\n%s\\nLearn more: %s", + "1260": "Route \"%s\": Next.js encountered runtime data during prerendering or a navigation.\\n\\n\\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` accessed outside of \\`\\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\\n\\nWays to fix this:\\n - Provide a placeholder with \\`\\` around the data access\\n - If params are known, prerender them with \\`generateStaticParams\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", + "1261": "Route \"%s\": Next.js encountered the unstable value %s while prerendering.\\n\\nThis value can change between renders, so it must be either prerendered or computed later.\\n\\nWays to fix this:\\n - Render at request time by adding a dynamic data access (e.g. \\`await connection()\\`) before this call\\n - Prerender and cache the value with \\`\"use cache\"\\`\\n - Render the value on the client with \\`\"use client\"\\`\\n%s\\nLearn more: %s", + "1262": "Route \"%s\": Next.js encountered uncached or runtime data during prerendering.\\n\\n\\`fetch(...)\\`, \\`cookies()\\`, \\`headers()\\`, \\`params\\`, \\`searchParams\\`, or \\`connection()\\` accessed outside of \\`\\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\\n\\nWays to fix this:\\n - Cache the data access with \\`\"use cache\"\\`\\n - Provide a placeholder with \\`\\` around the data access\\n - If params are known, prerender them with \\`generateStaticParams\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", + "1263": "Route \"%s\": Next.js encountered runtime data during prerendering.\\n\\n\\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` accessed outside of \\`\\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\\n\\nWays to fix this:\\n - Provide a placeholder with \\`\\` around the data access\\n - If params are known, prerender them with \\`generateStaticParams\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", + "1264": "Route \"%s\": Next.js encountered uncached data during prerendering or a navigation.\\n\\n\\`fetch(...)\\` or \\`connection()\\` accessed outside of \\`\\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\\n\\nWays to fix this:\\n - Cache the data access with \\`\"use cache\"\\`\\n - Provide a placeholder with \\`\\` around the data access\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", + "1265": "Route \"%s\": Next.js encountered uncached data during prerendering.\\n\\n\\`fetch(...)\\` or \\`connection()\\` accessed outside of \\`\\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\\n\\nWays to fix this:\\n - Cache the data access with \\`\"use cache\"\\`\\n - Provide a placeholder with \\`\\` around the data access\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", + "1266": "Route \"%s\": Next.js encountered the unstable value %s in a Client Component.\\n\\nThis value would be evaluated during the prerender, instead of recomputed on each visit.\\n\\nWays to fix this:\\n - Wrap the Client Component in \\`\\`\\n - Move the read into a \\`useEffect\\` or event handler\\n%s\\nLearn more: %s", + "1267": "Route \"%s\": Next.js encountered runtime data during prerendering.\\n\\n\\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` accessed outside of \\`\\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\\n\\nWays to fix this:\\n - Provide a placeholder with \\`\\` around the data access\\n - Prerender params if known with \\`generateStaticParams\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", + "1268": "Route \"%s\": Next.js encountered runtime data during prerendering or a navigation.\\n\\n\\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` accessed outside of \\`\\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\\n\\nWays to fix this:\\n - Provide a placeholder with \\`\\` around the data access\\n - Prerender params if known with \\`generateStaticParams\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", + "1269": "Route \"%s\": Next.js encountered uncached or runtime data during prerendering.\\n\\n\\`fetch(...)\\`, \\`cookies()\\`, \\`headers()\\`, \\`params\\`, \\`searchParams\\`, or \\`connection()\\` accessed outside of \\`\\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\\n\\nWays to fix this:\\n - Cache the data access with \\`\"use cache\"\\`\\n - Provide a placeholder with \\`\\` around the data access\\n - Prerender params if known with \\`generateStaticParams\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", + "1270": "Route \"%s\": Next.js encountered uncached or runtime data during prerendering.\\n\\n\\`fetch(...)\\`, \\`cookies()\\`, \\`headers()\\`, \\`params\\`, \\`searchParams\\`, or \\`connection()\\` accessed outside of \\`\\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\\n\\nWays to fix this:\\n - Cache the data access with \\`\"use cache\"\\`\\n - Provide a placeholder with \\`\\` around the data access\\n - If the runtime data is \\`params\\` and they're known, prerender them with \\`generateStaticParams\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", + "1271": "Route \"%s\": Next.js encountered runtime data during prerendering or a navigation.\\n\\n\\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` accessed outside of \\`\\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\\n\\nWays to fix this:\\n - Provide a placeholder with \\`\\` around the data access\\n - If the runtime data is \\`params\\` and they're known, prerender them with \\`generateStaticParams\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", + "1272": "Route \"%s\": Next.js encountered runtime data during prerendering.\\n\\n\\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` accessed outside of \\`\\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\\n\\nWays to fix this:\\n - Provide a placeholder with \\`\\` around the data access\\n - If the runtime data is \\`params\\` and they're known, prerender them with \\`generateStaticParams\\`\\n - Set \\`export const instant = false\\` to allow a blocking route\\n\\nLearn more: https://nextjs.org/docs/messages/blocking-route", + "1273": "\\`experimental.cssChunking: \"graph\"\\` is only supported with Turbopack. Please remove the option or run Next.js with Turbopack in %s.", + "1274": "\\`experimental.cssChunking: \"strict\"\\` is only supported with webpack. Please remove the option or run Next.js with webpack in %s.", + "1275": "\\`experimental.cssChunking: false\\` is only supported with webpack. Please remove the option or run Next.js with webpack in %s.", + "1276": "Compilation failed but no issues were recorded", + "1277": "no route matched for path \"%s\"", + "1278": "compileRoute: either routeSpecifier or path is required" } diff --git a/packages/next/src/next-devtools/dev-overlay/components/errors/dialog/dialog.tsx b/packages/next/src/next-devtools/dev-overlay/components/errors/dialog/dialog.tsx index 4691f16df33..cfc7dc6315e 100644 --- a/packages/next/src/next-devtools/dev-overlay/components/errors/dialog/dialog.tsx +++ b/packages/next/src/next-devtools/dev-overlay/components/errors/dialog/dialog.tsx @@ -39,6 +39,7 @@ export const DIALOG_STYLES = ` .error-overlay-dialog-scroll { overflow-y: auto; + scrollbar-gutter: stable; height: 100%; } ` diff --git a/packages/next/src/next-devtools/dev-overlay/components/instant/instant-guidance-data.ts b/packages/next/src/next-devtools/dev-overlay/components/instant/instant-guidance-data.ts index 1d6207dcb48..d513b1c11c0 100644 --- a/packages/next/src/next-devtools/dev-overlay/components/instant/instant-guidance-data.ts +++ b/packages/next/src/next-devtools/dev-overlay/components/instant/instant-guidance-data.ts @@ -16,7 +16,7 @@ export type FixCardIcon = | 'database' | 'history' | 'layout' - | 'octagon' + | 'loading' | 'pointer-click' | 'server-stack' | 'timer' @@ -28,7 +28,7 @@ export const FIX_CARD_GROUPS: Record< > = { stream: { label: 'Stream', color: 'blue', icon: 'align-left' }, prerender: { label: 'Prerender', color: 'purple', icon: 'history' }, - block: { label: 'Block', color: 'red', icon: 'octagon' }, + block: { label: 'Block', color: 'red', icon: 'loading' }, cache: { label: 'Cache', color: 'purple', icon: 'database' }, static: { label: 'Static', color: 'gray', icon: 'zap' }, dynamic: { label: 'Dynamic', color: 'blue', icon: 'server-stack' }, @@ -77,7 +77,7 @@ const runtimeCards: FixCard[] = [ }, { id: 'prerender-known-params', - title: 'Prerender known params', + title: 'For known params, prerender', group: 'cache', link: 'https://nextjs.org/docs/messages/blocking-route#prerender-known-params', snippets: [ @@ -162,7 +162,7 @@ const metadataRuntimeCards: FixCard[] = [ }, { id: 'render-page-at-request-time', - title: 'Generate the page on every request', + title: 'Mark the route as dynamic', group: 'dynamic', link: 'https://nextjs.org/docs/messages/next-prerender-dynamic-metadata#render-page-at-request-time', snippets: [ @@ -186,7 +186,7 @@ const metadataDynamicCards: FixCard[] = [ }, { id: 'render-page-at-request-time', - title: 'Generate the page on every request', + title: 'Mark the route as dynamic', group: 'dynamic', link: 'https://nextjs.org/docs/messages/next-prerender-dynamic-metadata#render-page-at-request-time', snippets: [ @@ -210,17 +210,6 @@ const viewportRuntimeCards: FixCard[] = [ { text: '}' }, ], }, - { - id: 'wrap-body-in-suspense', - title: 'Wrap body in Suspense', - group: 'stream', - link: 'https://nextjs.org/docs/messages/next-prerender-dynamic-viewport#wrap-body-in-suspense', - snippets: [ - { text: '', highlight: true }, - { text: ' {children}' }, - { text: '', highlight: true }, - ], - }, { id: 'allow-blocking-route', title: 'Allow blocking route', @@ -245,17 +234,6 @@ const viewportDynamicCards: FixCard[] = [ { text: ' return await db.getViewport(…)' }, ], }, - { - id: 'wrap-body-in-suspense', - title: 'Wrap body in Suspense', - group: 'stream', - link: 'https://nextjs.org/docs/messages/next-prerender-dynamic-viewport#wrap-body-in-suspense', - snippets: [ - { text: '', highlight: true }, - { text: ' {children}' }, - { text: '', highlight: true }, - ], - }, { id: 'allow-blocking-route', title: 'Allow blocking route', @@ -300,8 +278,8 @@ const syncMathCards: FixCard[] = [ link: 'https://nextjs.org/docs/messages/next-prerender-random#render-on-the-client', snippets: [ { text: '"use client"', highlight: true }, - { text: 'const [id] = useState(() => Math.random())' }, - { text: 'return ' }, + { text: '// runs in the browser' }, + { text: 'const id = Math.random()' }, ], }, ] @@ -336,13 +314,13 @@ const syncDateCards: FixCard[] = [ link: 'https://nextjs.org/docs/messages/next-prerender-current-time#render-on-the-client', snippets: [ { text: '"use client"', highlight: true }, - { text: 'useEffect(() => setT(Date.now()), [])' }, - { text: 'return ' }, + { text: '// runs in the browser' }, + { text: 'const t = Date.now()' }, ], }, { id: 'measure-elapsed-time', - title: 'Measure elapsed time', + title: 'For telemetry, use a timing API', group: 'measure', link: 'https://nextjs.org/docs/messages/next-prerender-current-time#measure-elapsed-time', snippets: [ @@ -383,8 +361,8 @@ const syncCryptoCards: FixCard[] = [ link: 'https://nextjs.org/docs/messages/next-prerender-crypto#render-on-the-client', snippets: [ { text: '"use client"', highlight: true }, - { text: 'const [id] = useState(() => crypto.randomUUID())' }, - { text: 'return ' }, + { text: '// runs in the browser' }, + { text: 'const id = crypto.randomUUID()' }, ], }, ] @@ -416,7 +394,7 @@ const syncClientDateCards: FixCard[] = [ }, { id: 'measure-elapsed-time', - title: 'Measure elapsed time', + title: 'For telemetry, use a timing API', group: 'measure', link: 'https://nextjs.org/docs/messages/next-prerender-current-time-client#measure-elapsed-time', snippets: [ diff --git a/packages/next/src/next-devtools/dev-overlay/components/instant/instant-guidance.tsx b/packages/next/src/next-devtools/dev-overlay/components/instant/instant-guidance.tsx index 6d8329438de..5d7cb053853 100644 --- a/packages/next/src/next-devtools/dev-overlay/components/instant/instant-guidance.tsx +++ b/packages/next/src/next-devtools/dev-overlay/components/instant/instant-guidance.tsx @@ -3,7 +3,7 @@ import { FixCardDatabaseIcon, FixCardHistoryIcon, FixCardLayoutIcon, - FixCardOctagonIcon, + FixCardLoadingIcon, FixCardPointerClickIcon, FixCardServerStackIcon, FixCardTimerIcon, @@ -41,8 +41,8 @@ function getCardIcon(icon: FixCardIcon) { return case 'timer': return - case 'octagon': - return + case 'loading': + return case 'zap': return case 'layout': @@ -237,7 +237,6 @@ export const INSTANT_GUIDANCE_STYLES = css` display: flex; flex-direction: column; min-width: 0; - overflow: hidden; position: relative; text-decoration: none; } @@ -254,6 +253,15 @@ export const INSTANT_GUIDANCE_STYLES = css` background: var(--color-background-200); } + [data-nextjs-fix-card]:hover [data-nextjs-fix-card-link-icon] { + color: var(--color-gray-1000); + } + + [data-nextjs-fix-card]:hover [data-nextjs-fix-snippet] { + border-color: var(--color-gray-500); + background: var(--color-gray-100); + } + a[data-nextjs-fix-card]:focus-visible { outline: var(--focus-ring); outline-offset: 2px; @@ -333,6 +341,7 @@ export const INSTANT_GUIDANCE_STYLES = css` line-height: 1.5; margin: 0; margin-left: -1px; + margin-bottom: -1px; padding: 14px 16px; width: calc(100% + 2px); white-space: pre; @@ -346,11 +355,6 @@ export const INSTANT_GUIDANCE_STYLES = css` text-align: left; } - [data-nextjs-fix-card]:hover [data-nextjs-fix-snippet] { - border-color: var(--color-gray-500); - background: var(--color-gray-100); - } - [data-snippet-line] { display: block; color: var(--color-gray-800); diff --git a/packages/next/src/next-devtools/dev-overlay/container/errors.tsx b/packages/next/src/next-devtools/dev-overlay/container/errors.tsx index a0d19b6aeff..0cb632cef28 100644 --- a/packages/next/src/next-devtools/dev-overlay/container/errors.tsx +++ b/packages/next/src/next-devtools/dev-overlay/container/errors.tsx @@ -325,7 +325,7 @@ export function isSyncIOClientError(message: string): boolean { // Detects errors emitted during navigation-phase instant validation: body // errors from `createRuntimeBodyErrorInNavigation` / // `createDynamicBodyErrorInNavigation` (SSR factories instead say "during -// the initial render"), and validation errors from +// prerendering"), and validation errors from // `trackDynamicHoleInNavigation` / `getNavigationDisallowedDynamicReasons`. export function isBlockingRouteInNavError(message: string): boolean { return ( @@ -559,10 +559,10 @@ Next.js version: ${props.versionInfo.installed} (${process.env.__NEXT_BUNDLER})\ errorDetails.variant === 'runtime' ? errorDetails.inNavigation ? 'Next.js encountered runtime data during a navigation.' - : 'Next.js encountered runtime data during the initial render.' + : 'Next.js encountered runtime data during prerendering.' : errorDetails.inNavigation ? 'Next.js encountered uncached data during a navigation.' - : 'Next.js encountered uncached data during the initial render.' + : 'Next.js encountered uncached data during prerendering.' } headerChildren={ - Next.js encountered {errorDetails.cause} without an - explicit rendering intent. + Next.js encountered the unstable value{' '} + {errorDetails.cause} while prerendering. } headerChildren={ @@ -724,13 +724,13 @@ Next.js version: ${props.versionInfo.installed} (${process.env.__NEXT_BUNDLER})\ errorType={errorType} errorMessage={ <> - Next.js encountered {errorDetails.cause} in a Client - Component. + Next.js encountered the unstable value{' '} + {errorDetails.cause} in a Client Component. } headerChildren={ } diff --git a/packages/next/src/next-devtools/dev-overlay/icons/fix-card-icons.tsx b/packages/next/src/next-devtools/dev-overlay/icons/fix-card-icons.tsx index 4e06caf331e..e6e204b3cbf 100644 --- a/packages/next/src/next-devtools/dev-overlay/icons/fix-card-icons.tsx +++ b/packages/next/src/next-devtools/dev-overlay/icons/fix-card-icons.tsx @@ -46,7 +46,7 @@ export function FixCardHistoryIcon() { ) } -export function FixCardOctagonIcon() { +export function FixCardLoadingIcon() { return ( - + {Array.from({ length: 12 }, (_, index) => { + const angle = index * 30 + const opacity = 1 - index * 0.05 + + return ( + + ) + })} ) } diff --git a/packages/next/src/server/app-render/blocking-route-messages.ts b/packages/next/src/server/app-render/blocking-route-messages.ts index 84801cc7a1d..7fb52f50ac5 100644 --- a/packages/next/src/server/app-render/blocking-route-messages.ts +++ b/packages/next/src/server/app-render/blocking-route-messages.ts @@ -1,10 +1,10 @@ export function createRuntimeBodyError(route: string): Error { return new Error( - `Route "${route}": Next.js encountered runtime data during the initial render.\n\n` + - `\`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience.\n\n` + + `Route "${route}": Next.js encountered runtime data during prerendering.\n\n` + + `\`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\n\n` + `Ways to fix this:\n` + ` - Provide a placeholder with \`\` around the data access\n` + - ` - Use \`generateStaticParams\` to make route params static\n` + + ` - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\`\n` + ` - Set \`export const instant = false\` to allow a blocking route\n\n` + `Learn more: https://nextjs.org/docs/messages/blocking-route` ) @@ -12,8 +12,8 @@ export function createRuntimeBodyError(route: string): Error { export function createDynamicBodyError(route: string): Error { return new Error( - `Route "${route}": Next.js encountered uncached data during the initial render.\n\n` + - `\`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience.\n\n` + + `Route "${route}": Next.js encountered uncached data during prerendering.\n\n` + + `\`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\n\n` + `Ways to fix this:\n` + ` - Cache the data access with \`"use cache"\`\n` + ` - Provide a placeholder with \`\` around the data access\n` + @@ -24,11 +24,11 @@ export function createDynamicBodyError(route: string): Error { export function createRuntimeBodyErrorInNavigation(route: string): Error { return new Error( - `Route "${route}": Next.js encountered runtime data during the initial render or a navigation.\n\n` + + `Route "${route}": Next.js encountered runtime data during prerendering or a navigation.\n\n` + `\`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\n\n` + `Ways to fix this:\n` + ` - Provide a placeholder with \`\` around the data access\n` + - ` - Use \`generateStaticParams\` to make route params static\n` + + ` - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\`\n` + ` - Set \`export const instant = false\` to allow a blocking route\n\n` + `Learn more: https://nextjs.org/docs/messages/blocking-route` ) @@ -36,7 +36,7 @@ export function createRuntimeBodyErrorInNavigation(route: string): Error { export function createDynamicBodyErrorInNavigation(route: string): Error { return new Error( - `Route "${route}": Next.js encountered uncached data during the initial render or a navigation.\n\n` + + `Route "${route}": Next.js encountered uncached data during prerendering or a navigation.\n\n` + `\`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\n\n` + `Ways to fix this:\n` + ` - Cache the data access with \`"use cache"\`\n` + @@ -53,12 +53,12 @@ export function createDynamicBodyErrorInNavigation(route: string): Error { */ export function createDynamicOrRuntimeBodyError(route: string): Error { return new Error( - `Route "${route}": Next.js encountered uncached or runtime data during the initial render.\n\n` + - `\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience.\n\n` + + `Route "${route}": Next.js encountered uncached or runtime data during prerendering.\n\n` + + `\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\n\n` + `Ways to fix this:\n` + ` - Cache the data access with \`"use cache"\`\n` + ` - Provide a placeholder with \`\` around the data access\n` + - ` - Use \`generateStaticParams\` to make route params static\n` + + ` - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\`\n` + ` - Set \`export const instant = false\` to allow a blocking route\n\n` + `Learn more: https://nextjs.org/docs/messages/blocking-route` ) @@ -92,7 +92,6 @@ export function createRuntimeViewportError(route: string): Error { `\`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` in \`generateViewport()\` prevents the page from being prerendered, leading to a slower user experience.\n\n` + `Ways to fix this:\n` + ` - Use a static viewport export instead of \`generateViewport()\`\n` + - ` - Wrap your document \`\` in \`\`\n` + ` - Set \`export const instant = false\` to allow a blocking route\n\n` + `Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport` ) @@ -104,7 +103,6 @@ export function createDynamicViewportError(route: string): Error { `\`fetch(...)\` or \`connection()\` in \`generateViewport()\` prevents the page from being prerendered, leading to a slower user experience.\n\n` + `Ways to fix this:\n` + ` - Cache the viewport data with \`"use cache"\` in \`generateViewport()\`\n` + - ` - Wrap your document \`\` in \`\`\n` + ` - Set \`export const instant = false\` to allow a blocking route\n\n` + `Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport` ) @@ -122,7 +120,6 @@ export function createDynamicOrRuntimeViewportError(route: string): Error { `Ways to fix this:\n` + ` - Use a static viewport export instead of \`generateViewport()\`\n` + ` - Cache the viewport data with \`"use cache"\` in \`generateViewport()\`\n` + - ` - Wrap your document \`\` in \`\`\n` + ` - Set \`export const instant = false\` to allow a blocking route\n\n` + `Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport` ) diff --git a/packages/next/src/server/app-render/sync-io-messages.ts b/packages/next/src/server/app-render/sync-io-messages.ts index 167465073a2..dedbd050d91 100644 --- a/packages/next/src/server/app-render/sync-io-messages.ts +++ b/packages/next/src/server/app-render/sync-io-messages.ts @@ -20,7 +20,7 @@ const SYNC_IO_RUNTIME_DOCS: Record = { function elapsedTimeBullet(type: SyncIOApiType): string { return type === 'time' - ? ` - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\`\n` + ? ` - If the value is for telemetry, use a timing API such as \`performance.now()\`\n` : '' } @@ -31,7 +31,7 @@ function createSyncIOErrorImpl( docsUrl: string ): Error { return new Error( - `Route "${route}": Next.js encountered ${expression} without an explicit rendering intent.\n\n` + + `Route "${route}": Next.js encountered the unstable value ${expression} while prerendering.\n\n` + `This value can change between renders, so it must be either prerendered or computed later.\n\n` + `Ways to fix this:\n` + ` - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call\n` + @@ -70,11 +70,12 @@ export function createSyncIOClientError( type: SyncIOApiType ): Error { return new Error( - `Route "${route}": Next.js encountered ${expression} in a Client Component.\n\n` + - `This value would be evaluated during the prerender and fixed at build time, instead of recomputed on each visit.\n\n` + + `Route "${route}": Next.js encountered the unstable value ${expression} in a Client Component.\n\n` + + `This value would be evaluated during the prerender, instead of recomputed on each visit.\n\n` + `Ways to fix this:\n` + ` - Wrap the Client Component in \`\`\n` + ` - Move the read into a \`useEffect\` or event handler\n` + + elapsedTimeBullet(type) + `\n` + `Learn more: ${SYNC_IO_CLIENT_DOCS[type]}` ) diff --git a/test/development/app-dir/cache-components-dev-cache-scope/cache-components-dev-cache-scope.test.ts b/test/development/app-dir/cache-components-dev-cache-scope/cache-components-dev-cache-scope.test.ts index 59306d0f7f8..8ffd60f4f7f 100644 --- a/test/development/app-dir/cache-components-dev-cache-scope/cache-components-dev-cache-scope.test.ts +++ b/test/development/app-dir/cache-components-dev-cache-scope/cache-components-dev-cache-scope.test.ts @@ -75,12 +75,12 @@ describe('Cache Components Dev Errors', () => { await openRedbox(browser) desc = await getRedboxDescription(browser) - expect(desc).toContain('during the initial render') + expect(desc).toContain('during prerendering') await browser.refresh() await openRedbox(browser) desc = await getRedboxDescription(browser) - expect(desc).toContain('during the initial render') + expect(desc).toContain('during prerendering') }) }) diff --git a/test/development/app-dir/cache-components-dev-errors/cache-components-dev-errors.test.ts b/test/development/app-dir/cache-components-dev-errors/cache-components-dev-errors.test.ts index b5125ab89b3..f1d829fcf6e 100644 --- a/test/development/app-dir/cache-components-dev-errors/cache-components-dev-errors.test.ts +++ b/test/development/app-dir/cache-components-dev-errors/cache-components-dev-errors.test.ts @@ -21,8 +21,8 @@ describe('Cache Components Dev Errors', () => { // soft-navigating to the page (see test below). await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered Math.random() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value Math.random() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/error/page.tsx (2:23) @ Page @@ -51,8 +51,8 @@ describe('Cache Components Dev Errors', () => { // TODO: React should not include the anon stack in the Owner Stack. await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered Math.random() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value Math.random() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/error/page.tsx (2:23) @ Page @@ -98,8 +98,8 @@ describe('Cache Components Dev Errors', () => { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1220", - "description": "Next.js encountered uncached data during the initial render.", + "code": "E1265", + "description": "Next.js encountered uncached data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/no-accessed-data/page.js (2:9) @ Page diff --git a/test/development/app-dir/cache-components-dev-fallback-validation/cache-components-dev-fallback-validation.test.ts b/test/development/app-dir/cache-components-dev-fallback-validation/cache-components-dev-fallback-validation.test.ts index 25a90576eba..2b7658bab07 100644 --- a/test/development/app-dir/cache-components-dev-fallback-validation/cache-components-dev-fallback-validation.test.ts +++ b/test/development/app-dir/cache-components-dev-fallback-validation/cache-components-dev-fallback-validation.test.ts @@ -52,8 +52,8 @@ describe('Cache Components Fallback Validation', () => { if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/partial/[top]/unwrapped/[bottom]/page.tsx (6:26) @ Page @@ -67,8 +67,8 @@ describe('Cache Components Fallback Validation', () => { } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/partial/[top]/unwrapped/[bottom]/page.tsx (6:26) @ Page @@ -85,8 +85,8 @@ describe('Cache Components Fallback Validation', () => { if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/partial/[top]/unwrapped/[bottom]/page.tsx (6:26) @ Page @@ -100,8 +100,8 @@ describe('Cache Components Fallback Validation', () => { } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/partial/[top]/unwrapped/[bottom]/page.tsx (6:26) @ Page @@ -118,8 +118,8 @@ describe('Cache Components Fallback Validation', () => { if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/partial/[top]/unwrapped/[bottom]/page.tsx (6:26) @ Page @@ -133,8 +133,8 @@ describe('Cache Components Fallback Validation', () => { } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/partial/[top]/unwrapped/[bottom]/page.tsx (6:26) @ Page @@ -155,8 +155,8 @@ describe('Cache Components Fallback Validation', () => { if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/none/[top]/wrapped/layout.tsx (10:3) @ Layout @@ -170,8 +170,8 @@ describe('Cache Components Fallback Validation', () => { } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/none/[top]/wrapped/layout.tsx (10:3) @ Layout @@ -188,8 +188,8 @@ describe('Cache Components Fallback Validation', () => { if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/none/[top]/wrapped/layout.tsx (10:3) @ Layout @@ -203,8 +203,8 @@ describe('Cache Components Fallback Validation', () => { } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/none/[top]/wrapped/layout.tsx (10:3) @ Layout @@ -221,8 +221,8 @@ describe('Cache Components Fallback Validation', () => { if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/none/[top]/wrapped/layout.tsx (10:3) @ Layout @@ -236,8 +236,8 @@ describe('Cache Components Fallback Validation', () => { } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/none/[top]/wrapped/layout.tsx (10:3) @ Layout @@ -254,8 +254,8 @@ describe('Cache Components Fallback Validation', () => { if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/none/[top]/unwrapped/layout.tsx (8:3) @ Layout @@ -269,8 +269,8 @@ describe('Cache Components Fallback Validation', () => { } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/none/[top]/unwrapped/layout.tsx (8:3) @ Layout @@ -287,8 +287,8 @@ describe('Cache Components Fallback Validation', () => { if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/none/[top]/unwrapped/layout.tsx (8:3) @ Layout @@ -302,8 +302,8 @@ describe('Cache Components Fallback Validation', () => { } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/none/[top]/unwrapped/layout.tsx (8:3) @ Layout @@ -320,8 +320,8 @@ describe('Cache Components Fallback Validation', () => { if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/none/[top]/unwrapped/layout.tsx (8:3) @ Layout @@ -335,8 +335,8 @@ describe('Cache Components Fallback Validation', () => { } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/none/[top]/unwrapped/layout.tsx (8:3) @ Layout diff --git a/test/e2e/app-dir/cache-components-errors/cache-components-errors.test.ts b/test/e2e/app-dir/cache-components-errors/cache-components-errors.test.ts index b42ee94dfb8..83c0236237f 100644 --- a/test/e2e/app-dir/cache-components-errors/cache-components-errors.test.ts +++ b/test/e2e/app-dir/cache-components-errors/cache-components-errors.test.ts @@ -158,8 +158,8 @@ describe('Cache Components Errors', () => { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1220", - "description": "Next.js encountered uncached data during the initial render.", + "code": "E1265", + "description": "Next.js encountered uncached data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/dynamic-metadata-error-route/page.tsx (21:9) @ Dynamic @@ -189,14 +189,14 @@ describe('Cache Components Errors', () => { if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/dynamic-metadata-error-route": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/dynamic-metadata-error-route": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -217,14 +217,14 @@ describe('Cache Components Errors', () => { `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/dynamic-metadata-error-route": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/dynamic-metadata-error-route": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -241,14 +241,14 @@ describe('Cache Components Errors', () => { } else { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/dynamic-metadata-error-route": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/dynamic-metadata-error-route": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -269,14 +269,14 @@ describe('Cache Components Errors', () => { `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/dynamic-metadata-error-route": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/dynamic-metadata-error-route": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -566,7 +566,7 @@ describe('Cache Components Errors', () => { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1210", + "code": "E1255", "description": "Next.js encountered uncached data in generateViewport().", "environmentLabel": "Server", "label": "Instant", @@ -601,7 +601,6 @@ describe('Cache Components Errors', () => { Ways to fix this: - Use a static viewport export instead of \`generateViewport()\` - Cache the viewport data with \`"use cache"\` in \`generateViewport()\` - - Wrap your document \`\` in \`\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport @@ -619,7 +618,6 @@ describe('Cache Components Errors', () => { Ways to fix this: - Use a static viewport export instead of \`generateViewport()\` - Cache the viewport data with \`"use cache"\` in \`generateViewport()\` - - Wrap your document \`\` in \`\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport @@ -678,7 +676,7 @@ describe('Cache Components Errors', () => { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1210", + "code": "E1255", "description": "Next.js encountered uncached data in generateViewport().", "environmentLabel": "Server", "label": "Instant", @@ -713,7 +711,6 @@ describe('Cache Components Errors', () => { Ways to fix this: - Use a static viewport export instead of \`generateViewport()\` - Cache the viewport data with \`"use cache"\` in \`generateViewport()\` - - Wrap your document \`\` in \`\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport @@ -731,7 +728,6 @@ describe('Cache Components Errors', () => { Ways to fix this: - Use a static viewport export instead of \`generateViewport()\` - Cache the viewport data with \`"use cache"\` in \`generateViewport()\` - - Wrap your document \`\` in \`\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport @@ -772,8 +768,8 @@ describe('Cache Components Errors', () => { await expect(browser).toDisplayCollapsedRedbox(` [ { - "code": "E1220", - "description": "Next.js encountered uncached data during the initial render.", + "code": "E1265", + "description": "Next.js encountered uncached data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/dynamic-root/page.tsx (63:26) @ fetchRandom @@ -786,8 +782,8 @@ describe('Cache Components Errors', () => { ], }, { - "code": "E1220", - "description": "Next.js encountered uncached data during the initial render.", + "code": "E1265", + "description": "Next.js encountered uncached data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/dynamic-root/page.tsx (63:26) @ fetchRandom @@ -818,14 +814,14 @@ describe('Cache Components Errors', () => { if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -840,14 +836,14 @@ describe('Cache Components Errors', () => { 64 | 'https://next-data-api-endpoint.vercel.app/api/random?b=' + entropy 65 | ) To debug the issue, start the app in development mode by running \`next dev\`, then open "/dynamic-root" in your browser to investigate the error. - Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during the initial render. + Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -869,14 +865,14 @@ describe('Cache Components Errors', () => { `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -894,14 +890,14 @@ describe('Cache Components Errors', () => { To get a more detailed stack trace and pinpoint the issue, try one of the following: - Start the app in development mode by running \`next dev\`, then open "/dynamic-root" in your browser to investigate the error. - Rerun the production build with \`next build --debug-prerender\` to generate better stack traces. - Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during the initial render. + Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -918,14 +914,14 @@ describe('Cache Components Errors', () => { } else { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -940,14 +936,14 @@ describe('Cache Components Errors', () => { 64 | 'https://next-data-api-endpoint.vercel.app/api/random?b=' + entropy 65 | ) To debug the issue, start the app in development mode by running \`next dev\`, then open "/dynamic-root" in your browser to investigate the error. - Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during the initial render. + Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -969,14 +965,14 @@ describe('Cache Components Errors', () => { `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -1008,14 +1004,14 @@ describe('Cache Components Errors', () => { To get a more detailed stack trace and pinpoint the issue, try one of the following: - Start the app in development mode by running \`next dev\`, then open "/dynamic-root" in your browser to investigate the error. - Rerun the production build with \`next build --debug-prerender\` to generate better stack traces. - Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during the initial render. + Error: Route "/dynamic-root": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -1093,8 +1089,8 @@ describe('Cache Components Errors', () => { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered Math.random() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value Math.random() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-random-with-fallback/page.tsx (37:23) @ RandomReadingComponent @@ -1123,7 +1119,7 @@ describe('Cache Components Errors', () => { if (isDebugPrerender) { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-random-with-fallback": Next.js encountered \`Math.random()\` without an explicit rendering intent. + "Error: Route "/sync-random-with-fallback": Next.js encountered the unstable value \`Math.random()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -1150,7 +1146,7 @@ describe('Cache Components Errors', () => { `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-random-with-fallback": Next.js encountered \`Math.random()\` without an explicit rendering intent. + "Error: Route "/sync-random-with-fallback": Next.js encountered the unstable value \`Math.random()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -1179,7 +1175,7 @@ describe('Cache Components Errors', () => { } else { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-random-with-fallback": Next.js encountered \`Math.random()\` without an explicit rendering intent. + "Error: Route "/sync-random-with-fallback": Next.js encountered the unstable value \`Math.random()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -1205,7 +1201,7 @@ describe('Cache Components Errors', () => { `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-random-with-fallback": Next.js encountered \`Math.random()\` without an explicit rendering intent. + "Error: Route "/sync-random-with-fallback": Next.js encountered the unstable value \`Math.random()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -1241,8 +1237,8 @@ describe('Cache Components Errors', () => { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered Math.random() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value Math.random() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-random-without-fallback/page.tsx (32:15) @ getRandomNumber @@ -1272,7 +1268,7 @@ describe('Cache Components Errors', () => { if (isDebugPrerender) { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-random-without-fallback": Next.js encountered \`Math.random()\` without an explicit rendering intent. + "Error: Route "/sync-random-without-fallback": Next.js encountered the unstable value \`Math.random()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -1300,7 +1296,7 @@ describe('Cache Components Errors', () => { `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-random-without-fallback": Next.js encountered \`Math.random()\` without an explicit rendering intent. + "Error: Route "/sync-random-without-fallback": Next.js encountered the unstable value \`Math.random()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -1330,7 +1326,7 @@ describe('Cache Components Errors', () => { } else { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-random-without-fallback": Next.js encountered \`Math.random()\` without an explicit rendering intent. + "Error: Route "/sync-random-without-fallback": Next.js encountered the unstable value \`Math.random()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -1356,7 +1352,7 @@ describe('Cache Components Errors', () => { `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-random-without-fallback": Next.js encountered \`Math.random()\` without an explicit rendering intent. + "Error: Route "/sync-random-without-fallback": Next.js encountered the unstable value \`Math.random()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -2181,8 +2177,8 @@ describe('Cache Components Errors', () => { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1228", - "description": "Next.js encountered new Date() in a Client Component.", + "code": "E1266", + "description": "Next.js encountered the unstable value new Date() in a Client Component.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-attribution/guarded-async-unguarded-clientsync/client.tsx (5:16) @ SyncIO @@ -2211,13 +2207,14 @@ describe('Cache Components Errors', () => { if (isDebugPrerender) { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-attribution/guarded-async-unguarded-clientsync": Next.js encountered \`new Date()\` in a Client Component. + "Error: Route "/sync-attribution/guarded-async-unguarded-clientsync": Next.js encountered the unstable value \`new Date()\` in a Client Component. - This value would be evaluated during the prerender and fixed at build time, instead of recomputed on each visit. + This value would be evaluated during the prerender, instead of recomputed on each visit. Ways to fix this: - Wrap the Client Component in \`\` - Move the read into a \`useEffect\` or event handler + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time-client at SyncIO (app/sync-attribution/guarded-async-unguarded-clientsync/client.tsx:5:16) @@ -2237,13 +2234,14 @@ describe('Cache Components Errors', () => { `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-attribution/guarded-async-unguarded-clientsync": Next.js encountered \`new Date()\` in a Client Component. + "Error: Route "/sync-attribution/guarded-async-unguarded-clientsync": Next.js encountered the unstable value \`new Date()\` in a Client Component. - This value would be evaluated during the prerender and fixed at build time, instead of recomputed on each visit. + This value would be evaluated during the prerender, instead of recomputed on each visit. Ways to fix this: - Wrap the Client Component in \`\` - Move the read into a \`useEffect\` or event handler + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time-client at SyncIO (webpack:///app/sync-attribution/guarded-async-unguarded-clientsync/client.tsx:5:16) @@ -2265,13 +2263,14 @@ describe('Cache Components Errors', () => { } else { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-attribution/guarded-async-unguarded-clientsync": Next.js encountered \`new Date()\` in a Client Component. + "Error: Route "/sync-attribution/guarded-async-unguarded-clientsync": Next.js encountered the unstable value \`new Date()\` in a Client Component. - This value would be evaluated during the prerender and fixed at build time, instead of recomputed on each visit. + This value would be evaluated during the prerender, instead of recomputed on each visit. Ways to fix this: - Wrap the Client Component in \`\` - Move the read into a \`useEffect\` or event handler + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time-client at (app/sync-attribution/guarded-async-unguarded-clientsync/client.tsx:5:16) @@ -2290,13 +2289,14 @@ describe('Cache Components Errors', () => { `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-attribution/guarded-async-unguarded-clientsync": Next.js encountered \`new Date()\` in a Client Component. + "Error: Route "/sync-attribution/guarded-async-unguarded-clientsync": Next.js encountered the unstable value \`new Date()\` in a Client Component. - This value would be evaluated during the prerender and fixed at build time, instead of recomputed on each visit. + This value would be evaluated during the prerender, instead of recomputed on each visit. Ways to fix this: - Wrap the Client Component in \`\` - Move the read into a \`useEffect\` or event handler + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time-client at a () @@ -2325,8 +2325,8 @@ describe('Cache Components Errors', () => { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-attribution/unguarded-async-guarded-clientsync/page.tsx (34:18) @ RequestData @@ -2355,14 +2355,14 @@ describe('Cache Components Errors', () => { if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-attribution/unguarded-async-guarded-clientsync": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/sync-attribution/unguarded-async-guarded-clientsync": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -2383,14 +2383,14 @@ describe('Cache Components Errors', () => { `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-attribution/unguarded-async-guarded-clientsync": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/sync-attribution/unguarded-async-guarded-clientsync": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -2409,14 +2409,14 @@ describe('Cache Components Errors', () => { } else { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-attribution/unguarded-async-guarded-clientsync": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/sync-attribution/unguarded-async-guarded-clientsync": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -2441,7 +2441,7 @@ describe('Cache Components Errors', () => { // non-debug-prerender mode, so we don't assert on the stack // frames here. expect(output).toInclude( - 'Error: Route "/sync-attribution/unguarded-async-guarded-clientsync": Next.js encountered uncached or runtime data during the initial render.' + 'Error: Route "/sync-attribution/unguarded-async-guarded-clientsync": Next.js encountered uncached or runtime data during prerendering.' ) } } @@ -2463,8 +2463,8 @@ describe('Cache Components Errors', () => { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1228", - "description": "Next.js encountered new Date() in a Client Component.", + "code": "E1266", + "description": "Next.js encountered the unstable value new Date() in a Client Component.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-attribution/unguarded-async-unguarded-clientsync/client.tsx (5:16) @ SyncIO @@ -2493,13 +2493,14 @@ describe('Cache Components Errors', () => { if (isDebugPrerender) { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-attribution/unguarded-async-unguarded-clientsync": Next.js encountered \`new Date()\` in a Client Component. + "Error: Route "/sync-attribution/unguarded-async-unguarded-clientsync": Next.js encountered the unstable value \`new Date()\` in a Client Component. - This value would be evaluated during the prerender and fixed at build time, instead of recomputed on each visit. + This value would be evaluated during the prerender, instead of recomputed on each visit. Ways to fix this: - Wrap the Client Component in \`\` - Move the read into a \`useEffect\` or event handler + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time-client at SyncIO (app/sync-attribution/unguarded-async-unguarded-clientsync/client.tsx:5:16) @@ -2519,13 +2520,14 @@ describe('Cache Components Errors', () => { `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-attribution/unguarded-async-unguarded-clientsync": Next.js encountered \`new Date()\` in a Client Component. + "Error: Route "/sync-attribution/unguarded-async-unguarded-clientsync": Next.js encountered the unstable value \`new Date()\` in a Client Component. - This value would be evaluated during the prerender and fixed at build time, instead of recomputed on each visit. + This value would be evaluated during the prerender, instead of recomputed on each visit. Ways to fix this: - Wrap the Client Component in \`\` - Move the read into a \`useEffect\` or event handler + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time-client at SyncIO (webpack:///app/sync-attribution/unguarded-async-unguarded-clientsync/client.tsx:5:16) @@ -2547,13 +2549,14 @@ describe('Cache Components Errors', () => { } else { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-attribution/unguarded-async-unguarded-clientsync": Next.js encountered \`new Date()\` in a Client Component. + "Error: Route "/sync-attribution/unguarded-async-unguarded-clientsync": Next.js encountered the unstable value \`new Date()\` in a Client Component. - This value would be evaluated during the prerender and fixed at build time, instead of recomputed on each visit. + This value would be evaluated during the prerender, instead of recomputed on each visit. Ways to fix this: - Wrap the Client Component in \`\` - Move the read into a \`useEffect\` or event handler + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time-client at (app/sync-attribution/unguarded-async-unguarded-clientsync/client.tsx:5:16) @@ -2572,13 +2575,14 @@ describe('Cache Components Errors', () => { `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-attribution/unguarded-async-unguarded-clientsync": Next.js encountered \`new Date()\` in a Client Component. + "Error: Route "/sync-attribution/unguarded-async-unguarded-clientsync": Next.js encountered the unstable value \`new Date()\` in a Client Component. - This value would be evaluated during the prerender and fixed at build time, instead of recomputed on each visit. + This value would be evaluated during the prerender, instead of recomputed on each visit. Ways to fix this: - Wrap the Client Component in \`\` - Move the read into a \`useEffect\` or event handler + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time-client at a () @@ -3037,8 +3041,8 @@ describe('Cache Components Errors', () => { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/use-cache-low-expire/fast/page.tsx (3:16) @ Page @@ -3066,14 +3070,14 @@ describe('Cache Components Errors', () => { if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/use-cache-low-expire/fast": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/use-cache-low-expire/fast": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3093,14 +3097,14 @@ describe('Cache Components Errors', () => { `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/use-cache-low-expire/fast": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/use-cache-low-expire/fast": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3120,28 +3124,28 @@ describe('Cache Components Errors', () => { // Next.js internals, and is also flaky on resolving the exact // location, so we don't assert on the stack frames here. expect(output).toInclude( - `Error: Route "/use-cache-low-expire/fast": Next.js encountered uncached or runtime data during the initial render. + `Error: Route "/use-cache-low-expire/fast": Next.js encountered uncached or runtime data during prerendering. -\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. +\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route` ) } else { expect(output).toInclude( - `Error: Route "/use-cache-low-expire/fast": Next.js encountered uncached or runtime data during the initial render. + `Error: Route "/use-cache-low-expire/fast": Next.js encountered uncached or runtime data during prerendering. -\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. +\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route` @@ -3159,8 +3163,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/use-cache-low-expire/slow/page.tsx (3:16) @ Page @@ -3188,14 +3192,14 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/use-cache-low-expire/slow": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/use-cache-low-expire/slow": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3215,14 +3219,14 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/use-cache-low-expire/slow": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/use-cache-low-expire/slow": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3242,28 +3246,28 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` // Next.js internals, and is also flaky on resolving the exact // location, so we don't assert on the stack frames here. expect(output).toInclude( - `Error: Route "/use-cache-low-expire/slow": Next.js encountered uncached or runtime data during the initial render. + `Error: Route "/use-cache-low-expire/slow": Next.js encountered uncached or runtime data during prerendering. -\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. +\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route` ) } else { expect(output).toInclude( - `Error: Route "/use-cache-low-expire/slow": Next.js encountered uncached or runtime data during the initial render. + `Error: Route "/use-cache-low-expire/slow": Next.js encountered uncached or runtime data during prerendering. -\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. +\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route` @@ -3440,8 +3444,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/use-cache-revalidate-0/fast/page.tsx (3:16) @ Page @@ -3469,14 +3473,14 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/use-cache-revalidate-0/fast": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/use-cache-revalidate-0/fast": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3496,14 +3500,14 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/use-cache-revalidate-0/fast": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/use-cache-revalidate-0/fast": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3523,28 +3527,28 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` // Next.js internals, and is also flaky on resolving the exact // location, so we don't assert on the stack frames here. expect(output).toInclude( - `Error: Route "/use-cache-revalidate-0/fast": Next.js encountered uncached or runtime data during the initial render. + `Error: Route "/use-cache-revalidate-0/fast": Next.js encountered uncached or runtime data during prerendering. -\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. +\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route` ) } else { expect(output).toInclude( - `Error: Route "/use-cache-revalidate-0/fast": Next.js encountered uncached or runtime data during the initial render. + `Error: Route "/use-cache-revalidate-0/fast": Next.js encountered uncached or runtime data during prerendering. -\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. +\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route` @@ -3562,8 +3566,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/use-cache-revalidate-0/slow/page.tsx (3:16) @ Page @@ -3591,14 +3595,14 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/use-cache-revalidate-0/slow": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/use-cache-revalidate-0/slow": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3618,14 +3622,14 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/use-cache-revalidate-0/slow": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/use-cache-revalidate-0/slow": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3645,28 +3649,28 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` // Next.js internals, and is also flaky on resolving the exact // location, so we don't assert on the stack frames here. expect(output).toInclude( - `Error: Route "/use-cache-revalidate-0/slow": Next.js encountered uncached or runtime data during the initial render. + `Error: Route "/use-cache-revalidate-0/slow": Next.js encountered uncached or runtime data during prerendering. -\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. +\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route` ) } else { expect(output).toInclude( - `Error: Route "/use-cache-revalidate-0/slow": Next.js encountered uncached or runtime data during the initial render. + `Error: Route "/use-cache-revalidate-0/slow": Next.js encountered uncached or runtime data during prerendering. -\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. +\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route` @@ -3844,8 +3848,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": null, @@ -3871,14 +3875,14 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/use-cache-params/[slug]": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/use-cache-params/[slug]": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3896,14 +3900,14 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/use-cache-params/[slug]": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/use-cache-params/[slug]": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3923,11 +3927,11 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` // Next.js internals, and is also flaky on resolving the exact // location, so we don't assert on the stack frames here. expect(output).toInclude( - `Error: Route "/use-cache-params/[slug]": Next.js encountered uncached or runtime data during the initial render.` + `Error: Route "/use-cache-params/[slug]": Next.js encountered uncached or runtime data during prerendering.` ) } else { expect(output).toInclude( - `Error: Route "/use-cache-params/[slug]": Next.js encountered uncached or runtime data during the initial render.` + `Error: Route "/use-cache-params/[slug]": Next.js encountered uncached or runtime data during prerendering.` ) } } @@ -4745,8 +4749,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1221", - "description": "Next.js encountered runtime data during the initial render.", + "code": "E1272", + "description": "Next.js encountered runtime data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/use-cache-private-without-suspense/page.tsx (15:1) @ Private @@ -4775,14 +4779,14 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/use-cache-private-without-suspense": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/use-cache-private-without-suspense": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -4803,14 +4807,14 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/use-cache-private-without-suspense": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/use-cache-private-without-suspense": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -4830,28 +4834,28 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` // Next.js internals, and is also flaky on resolving the exact // location, so we don't assert on the stack frames here. expect(output).toInclude( - `Error: Route "/use-cache-private-without-suspense": Next.js encountered uncached or runtime data during the initial render. + `Error: Route "/use-cache-private-without-suspense": Next.js encountered uncached or runtime data during prerendering. -\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. +\`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route` ) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/use-cache-private-without-suspense": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/use-cache-private-without-suspense": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -4948,8 +4952,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered Date() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value Date() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-current-time/date/page.tsx (19:16) @ DateReadingComponent @@ -4978,7 +4982,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isDebugPrerender) { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-current-time/date": Next.js encountered \`Date()\` without an explicit rendering intent. + "Error: Route "/sync-io-current-time/date": Next.js encountered the unstable value \`Date()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -4986,7 +4990,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time at DateReadingComponent (app/sync-io-current-time/date/page.tsx:19:16) @@ -5005,7 +5009,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-current-time/date": Next.js encountered \`Date()\` without an explicit rendering intent. + "Error: Route "/sync-io-current-time/date": Next.js encountered the unstable value \`Date()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5013,7 +5017,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time at DateReadingComponent (webpack:///app/sync-io-current-time/date/page.tsx:19:16) @@ -5034,7 +5038,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-current-time/date": Next.js encountered \`Date()\` without an explicit rendering intent. + "Error: Route "/sync-io-current-time/date": Next.js encountered the unstable value \`Date()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5042,7 +5046,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time at a (app/sync-io-current-time/date/page.tsx:19:16) @@ -5060,7 +5064,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-current-time/date": Next.js encountered \`Date()\` without an explicit rendering intent. + "Error: Route "/sync-io-current-time/date": Next.js encountered the unstable value \`Date()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5068,7 +5072,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time at a () @@ -5093,8 +5097,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered Date.now() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value Date.now() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-current-time/date-now/page.tsx (19:21) @ DateReadingComponent @@ -5123,7 +5127,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isDebugPrerender) { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-current-time/date-now": Next.js encountered \`Date.now()\` without an explicit rendering intent. + "Error: Route "/sync-io-current-time/date-now": Next.js encountered the unstable value \`Date.now()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5131,7 +5135,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time at DateReadingComponent (app/sync-io-current-time/date-now/page.tsx:19:21) @@ -5150,7 +5154,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-current-time/date-now": Next.js encountered \`Date.now()\` without an explicit rendering intent. + "Error: Route "/sync-io-current-time/date-now": Next.js encountered the unstable value \`Date.now()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5158,7 +5162,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time at DateReadingComponent (webpack:///app/sync-io-current-time/date-now/page.tsx:19:21) @@ -5179,7 +5183,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-current-time/date-now": Next.js encountered \`Date.now()\` without an explicit rendering intent. + "Error: Route "/sync-io-current-time/date-now": Next.js encountered the unstable value \`Date.now()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5187,7 +5191,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time at a (app/sync-io-current-time/date-now/page.tsx:19:21) @@ -5205,7 +5209,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-current-time/date-now": Next.js encountered \`Date.now()\` without an explicit rendering intent. + "Error: Route "/sync-io-current-time/date-now": Next.js encountered the unstable value \`Date.now()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5213,7 +5217,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time at a () @@ -5238,8 +5242,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered new Date() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value new Date() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-current-time/new-date/page.tsx (19:16) @ DateReadingComponent @@ -5268,7 +5272,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isDebugPrerender) { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-current-time/new-date": Next.js encountered \`new Date()\` without an explicit rendering intent. + "Error: Route "/sync-io-current-time/new-date": Next.js encountered the unstable value \`new Date()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5276,7 +5280,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time at DateReadingComponent (app/sync-io-current-time/new-date/page.tsx:19:16) @@ -5295,7 +5299,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-current-time/new-date": Next.js encountered \`new Date()\` without an explicit rendering intent. + "Error: Route "/sync-io-current-time/new-date": Next.js encountered the unstable value \`new Date()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5303,7 +5307,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time at DateReadingComponent (webpack:///app/sync-io-current-time/new-date/page.tsx:19:16) @@ -5324,7 +5328,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-current-time/new-date": Next.js encountered \`new Date()\` without an explicit rendering intent. + "Error: Route "/sync-io-current-time/new-date": Next.js encountered the unstable value \`new Date()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5332,7 +5336,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time at a (app/sync-io-current-time/new-date/page.tsx:19:16) @@ -5350,7 +5354,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-current-time/new-date": Next.js encountered \`new Date()\` without an explicit rendering intent. + "Error: Route "/sync-io-current-time/new-date": Next.js encountered the unstable value \`new Date()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5358,7 +5362,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time at a () @@ -5383,8 +5387,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered Math.random() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value Math.random() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-random/math-random/page.tsx (19:21) @ SyncIOComponent @@ -5413,7 +5417,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isDebugPrerender) { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-random/math-random": Next.js encountered \`Math.random()\` without an explicit rendering intent. + "Error: Route "/sync-io-random/math-random": Next.js encountered the unstable value \`Math.random()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5439,7 +5443,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-random/math-random": Next.js encountered \`Math.random()\` without an explicit rendering intent. + "Error: Route "/sync-io-random/math-random": Next.js encountered the unstable value \`Math.random()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5467,7 +5471,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-random/math-random": Next.js encountered \`Math.random()\` without an explicit rendering intent. + "Error: Route "/sync-io-random/math-random": Next.js encountered the unstable value \`Math.random()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5492,7 +5496,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-random/math-random": Next.js encountered \`Math.random()\` without an explicit rendering intent. + "Error: Route "/sync-io-random/math-random": Next.js encountered the unstable value \`Math.random()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5524,8 +5528,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered crypto.getRandomValues() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value crypto.getRandomValues() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-web-crypto/get-random-value/page.tsx (20:10) @ SyncIOComponent @@ -5554,7 +5558,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isDebugPrerender) { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-web-crypto/get-random-value": Next.js encountered \`crypto.getRandomValues()\` without an explicit rendering intent. + "Error: Route "/sync-io-web-crypto/get-random-value": Next.js encountered the unstable value \`crypto.getRandomValues()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5581,7 +5585,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-web-crypto/get-random-value": Next.js encountered \`crypto.getRandomValues()\` without an explicit rendering intent. + "Error: Route "/sync-io-web-crypto/get-random-value": Next.js encountered the unstable value \`crypto.getRandomValues()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5610,7 +5614,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-web-crypto/get-random-value": Next.js encountered \`crypto.getRandomValues()\` without an explicit rendering intent. + "Error: Route "/sync-io-web-crypto/get-random-value": Next.js encountered the unstable value \`crypto.getRandomValues()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5636,7 +5640,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-web-crypto/get-random-value": Next.js encountered \`crypto.getRandomValues()\` without an explicit rendering intent. + "Error: Route "/sync-io-web-crypto/get-random-value": Next.js encountered the unstable value \`crypto.getRandomValues()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5668,8 +5672,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered crypto.randomUUID() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value crypto.randomUUID() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-web-crypto/random-uuid/page.tsx (19:23) @ SyncIOComponent @@ -5698,7 +5702,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isDebugPrerender) { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-web-crypto/random-uuid": Next.js encountered \`crypto.randomUUID()\` without an explicit rendering intent. + "Error: Route "/sync-io-web-crypto/random-uuid": Next.js encountered the unstable value \`crypto.randomUUID()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5724,7 +5728,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-web-crypto/random-uuid": Next.js encountered \`crypto.randomUUID()\` without an explicit rendering intent. + "Error: Route "/sync-io-web-crypto/random-uuid": Next.js encountered the unstable value \`crypto.randomUUID()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5752,7 +5756,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isTurbopack) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-web-crypto/random-uuid": Next.js encountered \`crypto.randomUUID()\` without an explicit rendering intent. + "Error: Route "/sync-io-web-crypto/random-uuid": Next.js encountered the unstable value \`crypto.randomUUID()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5777,7 +5781,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-web-crypto/random-uuid": Next.js encountered \`crypto.randomUUID()\` without an explicit rendering intent. + "Error: Route "/sync-io-web-crypto/random-uuid": Next.js encountered the unstable value \`crypto.randomUUID()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5810,8 +5814,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').generateKeyPairSync(...) without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').generateKeyPairSync(...) while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/generate-key-pair-sync/page.tsx (20:24) @ SyncIOComponent @@ -5826,8 +5830,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').generateKeyPairSync(...) without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').generateKeyPairSync(...) while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/generate-key-pair-sync/page.tsx (20:17) @ SyncIOComponent @@ -5857,7 +5861,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/generate-key-pair-sync": Next.js encountered \`require('node:crypto').generateKeyPairSync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/generate-key-pair-sync": Next.js encountered the unstable value \`require('node:crypto').generateKeyPairSync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5884,7 +5888,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/generate-key-pair-sync": Next.js encountered \`require('node:crypto').generateKeyPairSync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/generate-key-pair-sync": Next.js encountered the unstable value \`require('node:crypto').generateKeyPairSync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5912,7 +5916,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/generate-key-pair-sync": Next.js encountered \`require('node:crypto').generateKeyPairSync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/generate-key-pair-sync": Next.js encountered the unstable value \`require('node:crypto').generateKeyPairSync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5939,7 +5943,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/generate-key-pair-sync": Next.js encountered \`require('node:crypto').generateKeyPairSync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/generate-key-pair-sync": Next.js encountered the unstable value \`require('node:crypto').generateKeyPairSync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -5972,8 +5976,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').generateKeySync(...) without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').generateKeySync(...) while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/generate-key-sync/page.tsx (21:6) @ SyncIOComponent @@ -5988,8 +5992,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').generateKeySync(...) without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').generateKeySync(...) while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/generate-key-sync/page.tsx (20:17) @ SyncIOComponent @@ -6019,7 +6023,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/generate-key-sync": Next.js encountered \`require('node:crypto').generateKeySync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/generate-key-sync": Next.js encountered the unstable value \`require('node:crypto').generateKeySync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6046,7 +6050,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/generate-key-sync": Next.js encountered \`require('node:crypto').generateKeySync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/generate-key-sync": Next.js encountered the unstable value \`require('node:crypto').generateKeySync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6074,7 +6078,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/generate-key-sync": Next.js encountered \`require('node:crypto').generateKeySync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/generate-key-sync": Next.js encountered the unstable value \`require('node:crypto').generateKeySync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6101,7 +6105,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/generate-key-sync": Next.js encountered \`require('node:crypto').generateKeySync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/generate-key-sync": Next.js encountered the unstable value \`require('node:crypto').generateKeySync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6134,8 +6138,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').generatePrimeSync(...) without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').generatePrimeSync(...) while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/generate-prime-sync/page.tsx (20:39) @ SyncIOComponent @@ -6150,8 +6154,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').generatePrimeSync(...) without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').generatePrimeSync(...) while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/generate-prime-sync/page.tsx (20:32) @ SyncIOComponent @@ -6181,7 +6185,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/generate-prime-sync": Next.js encountered \`require('node:crypto').generatePrimeSync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/generate-prime-sync": Next.js encountered the unstable value \`require('node:crypto').generatePrimeSync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6208,7 +6212,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/generate-prime-sync": Next.js encountered \`require('node:crypto').generatePrimeSync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/generate-prime-sync": Next.js encountered the unstable value \`require('node:crypto').generatePrimeSync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6236,7 +6240,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/generate-prime-sync": Next.js encountered \`require('node:crypto').generatePrimeSync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/generate-prime-sync": Next.js encountered the unstable value \`require('node:crypto').generatePrimeSync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6263,7 +6267,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/generate-prime-sync": Next.js encountered \`require('node:crypto').generatePrimeSync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/generate-prime-sync": Next.js encountered the unstable value \`require('node:crypto').generatePrimeSync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6296,8 +6300,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered crypto.getRandomValues() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value crypto.getRandomValues() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/get-random-values/page.tsx (21:10) @ SyncIOComponent @@ -6312,8 +6316,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered crypto.getRandomValues() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value crypto.getRandomValues() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/get-random-values/page.tsx (21:3) @ SyncIOComponent @@ -6343,7 +6347,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/get-random-values": Next.js encountered \`crypto.getRandomValues()\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/get-random-values": Next.js encountered the unstable value \`crypto.getRandomValues()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6370,7 +6374,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/get-random-values": Next.js encountered \`crypto.getRandomValues()\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/get-random-values": Next.js encountered the unstable value \`crypto.getRandomValues()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6398,7 +6402,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/get-random-values": Next.js encountered \`crypto.getRandomValues()\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/get-random-values": Next.js encountered the unstable value \`crypto.getRandomValues()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6425,7 +6429,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/get-random-values": Next.js encountered \`crypto.getRandomValues()\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/get-random-values": Next.js encountered the unstable value \`crypto.getRandomValues()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6458,8 +6462,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').randomBytes(size) without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').randomBytes(size) while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/random-bytes/page.tsx (20:24) @ SyncIOComponent @@ -6474,8 +6478,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').randomBytes(size) without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').randomBytes(size) while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/random-bytes/page.tsx (20:17) @ SyncIOComponent @@ -6505,7 +6509,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-bytes": Next.js encountered \`require('node:crypto').randomBytes(size)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-bytes": Next.js encountered the unstable value \`require('node:crypto').randomBytes(size)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6532,7 +6536,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-bytes": Next.js encountered \`require('node:crypto').randomBytes(size)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-bytes": Next.js encountered the unstable value \`require('node:crypto').randomBytes(size)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6560,7 +6564,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-bytes": Next.js encountered \`require('node:crypto').randomBytes(size)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-bytes": Next.js encountered the unstable value \`require('node:crypto').randomBytes(size)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6587,7 +6591,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-bytes": Next.js encountered \`require('node:crypto').randomBytes(size)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-bytes": Next.js encountered the unstable value \`require('node:crypto').randomBytes(size)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6620,8 +6624,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').randomFillSync(...) without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').randomFillSync(...) while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/random-fill-sync/page.tsx (21:10) @ SyncIOComponent @@ -6636,8 +6640,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').randomFillSync(...) without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').randomFillSync(...) while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/random-fill-sync/page.tsx (21:3) @ SyncIOComponent @@ -6667,7 +6671,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-fill-sync": Next.js encountered \`require('node:crypto').randomFillSync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-fill-sync": Next.js encountered the unstable value \`require('node:crypto').randomFillSync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6694,7 +6698,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-fill-sync": Next.js encountered \`require('node:crypto').randomFillSync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-fill-sync": Next.js encountered the unstable value \`require('node:crypto').randomFillSync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6722,7 +6726,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-fill-sync": Next.js encountered \`require('node:crypto').randomFillSync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-fill-sync": Next.js encountered the unstable value \`require('node:crypto').randomFillSync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6749,7 +6753,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-fill-sync": Next.js encountered \`require('node:crypto').randomFillSync(...)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-fill-sync": Next.js encountered the unstable value \`require('node:crypto').randomFillSync(...)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6782,8 +6786,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').randomInt(min, max) without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').randomInt(min, max) while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/random-int-between/page.tsx (20:24) @ SyncIOComponent @@ -6798,8 +6802,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').randomInt(min, max) without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').randomInt(min, max) while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/random-int-between/page.tsx (20:17) @ SyncIOComponent @@ -6829,7 +6833,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-int-between": Next.js encountered \`require('node:crypto').randomInt(min, max)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-int-between": Next.js encountered the unstable value \`require('node:crypto').randomInt(min, max)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6856,7 +6860,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-int-between": Next.js encountered \`require('node:crypto').randomInt(min, max)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-int-between": Next.js encountered the unstable value \`require('node:crypto').randomInt(min, max)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6884,7 +6888,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-int-between": Next.js encountered \`require('node:crypto').randomInt(min, max)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-int-between": Next.js encountered the unstable value \`require('node:crypto').randomInt(min, max)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6911,7 +6915,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-int-between": Next.js encountered \`require('node:crypto').randomInt(min, max)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-int-between": Next.js encountered the unstable value \`require('node:crypto').randomInt(min, max)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -6944,8 +6948,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').randomInt(min, max) without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').randomInt(min, max) while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/random-int-up-to/page.tsx (20:24) @ SyncIOComponent @@ -6960,8 +6964,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').randomInt(min, max) without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').randomInt(min, max) while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/random-int-up-to/page.tsx (20:17) @ SyncIOComponent @@ -6991,7 +6995,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-int-up-to": Next.js encountered \`require('node:crypto').randomInt(min, max)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-int-up-to": Next.js encountered the unstable value \`require('node:crypto').randomInt(min, max)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -7018,7 +7022,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-int-up-to": Next.js encountered \`require('node:crypto').randomInt(min, max)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-int-up-to": Next.js encountered the unstable value \`require('node:crypto').randomInt(min, max)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -7046,7 +7050,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-int-up-to": Next.js encountered \`require('node:crypto').randomInt(min, max)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-int-up-to": Next.js encountered the unstable value \`require('node:crypto').randomInt(min, max)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -7073,7 +7077,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-int-up-to": Next.js encountered \`require('node:crypto').randomInt(min, max)\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-int-up-to": Next.js encountered the unstable value \`require('node:crypto').randomInt(min, max)\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -7106,8 +7110,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').randomUUID() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').randomUUID() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/random-uuid/page.tsx (20:24) @ SyncIOComponent @@ -7122,8 +7126,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered require('node:crypto').randomUUID() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value require('node:crypto').randomUUID() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/sync-io-node-crypto/random-uuid/page.tsx (20:17) @ SyncIOComponent @@ -7153,7 +7157,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-uuid": Next.js encountered \`require('node:crypto').randomUUID()\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-uuid": Next.js encountered the unstable value \`require('node:crypto').randomUUID()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -7180,7 +7184,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-uuid": Next.js encountered \`require('node:crypto').randomUUID()\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-uuid": Next.js encountered the unstable value \`require('node:crypto').randomUUID()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -7208,7 +7212,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-uuid": Next.js encountered \`require('node:crypto').randomUUID()\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-uuid": Next.js encountered the unstable value \`require('node:crypto').randomUUID()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -7235,7 +7239,7 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/sync-io-node-crypto/random-uuid": Next.js encountered \`require('node:crypto').randomUUID()\` without an explicit rendering intent. + "Error: Route "/sync-io-node-crypto/random-uuid": Next.js encountered the unstable value \`require('node:crypto').randomUUID()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -7267,8 +7271,8 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1220", - "description": "Next.js encountered uncached data during the initial render.", + "code": "E1265", + "description": "Next.js encountered uncached data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/client-awaited-io/client.tsx (6:19) @ Client @@ -7297,14 +7301,14 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` if (isTurbopack) { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/client-awaited-io": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/client-awaited-io": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -7325,14 +7329,14 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/client-awaited-io": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/client-awaited-io": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -7356,14 +7360,14 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` } else { if (isDebugPrerender) { expect(output).toMatchInlineSnapshot(` - "Error: Route "/client-awaited-io": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/client-awaited-io": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -7384,14 +7388,14 @@ Learn more: https://nextjs.org/docs/messages/blocking-route` `) } else { expect(output).toMatchInlineSnapshot(` - "Error: Route "/client-awaited-io": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/client-awaited-io": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route diff --git a/test/e2e/app-dir/instant-validation-build/instant-validation-build.test.ts b/test/e2e/app-dir/instant-validation-build/instant-validation-build.test.ts index 13f2f996118..fc61df0e081 100644 --- a/test/e2e/app-dir/instant-validation-build/instant-validation-build.test.ts +++ b/test/e2e/app-dir/instant-validation-build/instant-validation-build.test.ts @@ -63,7 +63,7 @@ describe('instant-validation-build', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/invalid-missing-suspense-around-runtime": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/invalid-missing-suspense-around-runtime": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. diff --git a/test/e2e/app-dir/instant-validation-causes/instant-validation-causes.test.ts b/test/e2e/app-dir/instant-validation-causes/instant-validation-causes.test.ts index 1a9eb517f61..bc799b5a460 100644 --- a/test/e2e/app-dir/instant-validation-causes/instant-validation-causes.test.ts +++ b/test/e2e/app-dir/instant-validation-causes/instant-validation-causes.test.ts @@ -105,7 +105,7 @@ describe('instant validation causes', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -136,7 +136,7 @@ describe('instant validation causes', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -167,7 +167,7 @@ describe('instant validation causes', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -201,7 +201,7 @@ describe('instant validation causes', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", diff --git a/test/e2e/app-dir/instant-validation-level-error/instant-validation-level-error.test.ts b/test/e2e/app-dir/instant-validation-level-error/instant-validation-level-error.test.ts index ac346f83eb9..6e72ce24eb1 100644 --- a/test/e2e/app-dir/instant-validation-level-error/instant-validation-level-error.test.ts +++ b/test/e2e/app-dir/instant-validation-level-error/instant-validation-level-error.test.ts @@ -60,7 +60,7 @@ describe('instant validation - level error', () => { const browser = await next.browser('/bare') await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -90,7 +90,7 @@ describe('instant validation - level error', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -120,7 +120,7 @@ describe('instant validation - level error', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -150,7 +150,7 @@ describe('instant validation - level error', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -177,7 +177,7 @@ describe('instant validation - level error', () => { const browser = await next.browser('/layered') await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -197,7 +197,7 @@ describe('instant validation - level error', () => { const result = await prerender('/bare') expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/bare": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/bare": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. @@ -223,7 +223,7 @@ describe('instant validation - level error', () => { const result = await prerender('/explicit-error') expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/explicit-error": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/explicit-error": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. @@ -249,7 +249,7 @@ describe('instant validation - level error', () => { const result = await prerender('/explicit-true') expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/explicit-true": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/explicit-true": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. @@ -288,7 +288,7 @@ describe('instant validation - level error', () => { const result = await prerender('/layered') expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/layered": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/layered": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. diff --git a/test/e2e/app-dir/instant-validation-level-manual-error/instant-validation-level-manual-error.test.ts b/test/e2e/app-dir/instant-validation-level-manual-error/instant-validation-level-manual-error.test.ts index 74f9e9fdb44..a24af1ba3c9 100644 --- a/test/e2e/app-dir/instant-validation-level-manual-error/instant-validation-level-manual-error.test.ts +++ b/test/e2e/app-dir/instant-validation-level-manual-error/instant-validation-level-manual-error.test.ts @@ -79,7 +79,7 @@ describe('instant validation - level manual-error', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -109,7 +109,7 @@ describe('instant validation - level manual-error', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -139,7 +139,7 @@ describe('instant validation - level manual-error', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -180,7 +180,7 @@ describe('instant validation - level manual-error', () => { const result = await prerender('/explicit-error') expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/explicit-error": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/explicit-error": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. @@ -206,7 +206,7 @@ describe('instant validation - level manual-error', () => { const result = await prerender('/explicit-true') expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/explicit-true": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/explicit-true": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. diff --git a/test/e2e/app-dir/instant-validation-level-manual-warning/instant-validation-level-manual-warning.test.ts b/test/e2e/app-dir/instant-validation-level-manual-warning/instant-validation-level-manual-warning.test.ts index 7ca9596bed3..59452fc6446 100644 --- a/test/e2e/app-dir/instant-validation-level-manual-warning/instant-validation-level-manual-warning.test.ts +++ b/test/e2e/app-dir/instant-validation-level-manual-warning/instant-validation-level-manual-warning.test.ts @@ -93,7 +93,7 @@ describe('instant validation - level manual-warning', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -125,7 +125,7 @@ describe('instant validation - level manual-warning', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -157,7 +157,7 @@ describe('instant validation - level manual-warning', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -192,7 +192,7 @@ describe('instant validation - level manual-warning', () => { const result = await prerender('/with-root-suspense/explicit-error') expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/with-root-suspense/explicit-error": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/with-root-suspense/explicit-error": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. @@ -229,8 +229,8 @@ describe('instant validation - level manual-warning', () => { // did not run under 'manual-warning'. await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1220", - "description": "Next.js encountered uncached data during the initial render.", + "code": "E1265", + "description": "Next.js encountered uncached data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/without-root-suspense/bare/page.tsx (10:19) @ Page @@ -249,8 +249,8 @@ describe('instant validation - level manual-warning', () => { ) await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1220", - "description": "Next.js encountered uncached data during the initial render.", + "code": "E1265", + "description": "Next.js encountered uncached data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/without-root-suspense/explicit-error/page.tsx (11:19) @ Page @@ -269,8 +269,8 @@ describe('instant validation - level manual-warning', () => { ) await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1220", - "description": "Next.js encountered uncached data during the initial render.", + "code": "E1265", + "description": "Next.js encountered uncached data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/without-root-suspense/explicit-true/page.tsx (11:19) @ Page @@ -289,8 +289,8 @@ describe('instant validation - level manual-warning', () => { ) await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1220", - "description": "Next.js encountered uncached data during the initial render.", + "code": "E1265", + "description": "Next.js encountered uncached data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/without-root-suspense/explicit-warning/page.tsx (10:19) @ Page @@ -330,14 +330,14 @@ describe('instant validation - level manual-warning', () => { expectBuildFailedWithoutInstantValidation(result) expect(getPrerenderOutput(result.cliOutput, { isMinified: true })) .toMatchInlineSnapshot(` - "Error: Route "/without-root-suspense/bare": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/without-root-suspense/bare": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -356,14 +356,14 @@ describe('instant validation - level manual-warning', () => { expectBuildFailedWithoutInstantValidation(result) expect(getPrerenderOutput(result.cliOutput, { isMinified: true })) .toMatchInlineSnapshot(` - "Error: Route "/without-root-suspense/explicit-true": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/without-root-suspense/explicit-true": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -384,14 +384,14 @@ describe('instant validation - level manual-warning', () => { expectBuildFailedWithoutInstantValidation(result) expect(getPrerenderOutput(result.cliOutput, { isMinified: true })) .toMatchInlineSnapshot(` - "Error: Route "/without-root-suspense/explicit-warning": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/without-root-suspense/explicit-warning": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -416,14 +416,14 @@ describe('instant validation - level manual-warning', () => { expectBuildFailedWithoutInstantValidation(result) expect(getPrerenderOutput(result.cliOutput, { isMinified: true })) .toMatchInlineSnapshot(` - "Error: Route "/without-root-suspense/explicit-error": Next.js encountered uncached or runtime data during the initial render. + "Error: Route "/without-root-suspense/explicit-error": Next.js encountered uncached or runtime data during prerendering. - \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking navigation and leading to a slower user experience. + \`fetch(...)\`, \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or \`connection()\` accessed outside of \`\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience. Ways to fix this: - Cache the data access with \`"use cache"\` - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route diff --git a/test/e2e/app-dir/instant-validation-level-warning/instant-validation-level-warning.test.ts b/test/e2e/app-dir/instant-validation-level-warning/instant-validation-level-warning.test.ts index d3db682bad6..ced9212480d 100644 --- a/test/e2e/app-dir/instant-validation-level-warning/instant-validation-level-warning.test.ts +++ b/test/e2e/app-dir/instant-validation-level-warning/instant-validation-level-warning.test.ts @@ -60,7 +60,7 @@ describe('instant validation - level warning', () => { const browser = await next.browser('/bare') await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -90,7 +90,7 @@ describe('instant validation - level warning', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -120,7 +120,7 @@ describe('instant validation - level warning', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -150,7 +150,7 @@ describe('instant validation - level warning', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -177,7 +177,7 @@ describe('instant validation - level warning', () => { const browser = await next.browser('/layered') await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -202,7 +202,7 @@ describe('instant validation - level warning', () => { const result = await prerender('/explicit-error') expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/explicit-error": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/explicit-error": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. diff --git a/test/e2e/app-dir/instant-validation-static-shells/instant-validation-static-shells.test.ts b/test/e2e/app-dir/instant-validation-static-shells/instant-validation-static-shells.test.ts index 98eb6665f65..058273c8043 100644 --- a/test/e2e/app-dir/instant-validation-static-shells/instant-validation-static-shells.test.ts +++ b/test/e2e/app-dir/instant-validation-static-shells/instant-validation-static-shells.test.ts @@ -45,8 +45,8 @@ describe('instant validation', () => { await browser.elementByCss('main') await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1220", - "description": "Next.js encountered uncached data during the initial render.", + "code": "E1265", + "description": "Next.js encountered uncached data during prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/blocking-page-below-static/page.tsx (6:19) @ Page @@ -69,7 +69,7 @@ describe('instant validation', () => { }) it('errors during build', () => { expect(didBuildError).toBe(true) - expect(next.cliOutput).toContain('during the initial render') + expect(next.cliOutput).toContain('during prerendering') }) } }) diff --git a/test/e2e/app-dir/instant-validation/instant-validation-parallel-slots.test.ts b/test/e2e/app-dir/instant-validation/instant-validation-parallel-slots.test.ts index cefa1e09041..cc29f83ec03 100644 --- a/test/e2e/app-dir/instant-validation/instant-validation-parallel-slots.test.ts +++ b/test/e2e/app-dir/instant-validation/instant-validation-parallel-slots.test.ts @@ -124,7 +124,7 @@ describe('instant validation - parallel slot configs', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -142,13 +142,13 @@ describe('instant validation - parallel slot configs', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/parallel/slot-config-only": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/parallel/slot-config-only": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -184,7 +184,7 @@ describe('instant validation - parallel slot configs', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -202,13 +202,13 @@ describe('instant validation - parallel slot configs', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/parallel/slot-layout-config": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/parallel/slot-layout-config": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -244,7 +244,7 @@ describe('instant validation - parallel slot configs', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -262,13 +262,13 @@ describe('instant validation - parallel slot configs', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/parallel/slot-runtime-config": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/parallel/slot-runtime-config": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -306,7 +306,7 @@ describe('instant validation - parallel slot configs', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -324,13 +324,13 @@ describe('instant validation - parallel slot configs', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/parallel/children-config-with-slot": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/parallel/children-config-with-slot": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -368,7 +368,7 @@ describe('instant validation - parallel slot configs', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -392,7 +392,7 @@ describe('instant validation - parallel slot configs', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -411,13 +411,13 @@ describe('instant validation - parallel slot configs', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/parallel/fork-layout-config-with-slot": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/parallel/fork-layout-config-with-slot": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -425,13 +425,13 @@ describe('instant validation - parallel slot configs', () => { at body () at html () at a () - Error: Route "/suspense-in-root/parallel/fork-layout-config-with-slot": Next.js encountered runtime data during the initial render or a navigation. + Error: Route "/suspense-in-root/parallel/fork-layout-config-with-slot": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -535,7 +535,7 @@ describe('instant validation - parallel slot configs', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -551,13 +551,13 @@ describe('instant validation - parallel slot configs', () => { const result = await prerender(href) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/parallel/conditional-breadcrumbs/show-both/blocked": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/parallel/conditional-breadcrumbs/show-both/blocked": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -650,7 +650,7 @@ describe('instant validation - parallel slot configs', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -666,13 +666,13 @@ describe('instant validation - parallel slot configs', () => { const result = await prerender(href) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/parallel/conditional-breadcrumbs/show-only-breadcrumbs/blocked": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/parallel/conditional-breadcrumbs/show-only-breadcrumbs/blocked": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route diff --git a/test/e2e/app-dir/instant-validation/instant-validation.test.ts b/test/e2e/app-dir/instant-validation/instant-validation.test.ts index 9b3def2e15e..ef3778dedb5 100644 --- a/test/e2e/app-dir/instant-validation/instant-validation.test.ts +++ b/test/e2e/app-dir/instant-validation/instant-validation.test.ts @@ -180,7 +180,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -198,13 +198,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/missing-suspense-around-runtime": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/missing-suspense-around-runtime": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -240,7 +240,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -258,7 +258,7 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/missing-suspense-around-dynamic": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/missing-suspense-around-dynamic": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. @@ -300,7 +300,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -319,7 +319,7 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/runtime/missing-suspense-around-dynamic": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/suspense-in-root/runtime/missing-suspense-around-dynamic": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. @@ -363,7 +363,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -381,13 +381,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/missing-suspense-around-dynamic-layout": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/missing-suspense-around-dynamic-layout": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -423,7 +423,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -441,7 +441,7 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/runtime/missing-suspense-around-dynamic-layout": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/suspense-in-root/runtime/missing-suspense-around-dynamic-layout": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. @@ -486,7 +486,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -534,7 +534,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -552,13 +552,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/missing-suspense-around-search-params": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/missing-suspense-around-search-params": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -629,7 +629,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -647,13 +647,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/suspense-too-high": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/suspense-too-high": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -692,7 +692,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -711,7 +711,7 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/runtime/suspense-too-high": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/suspense-in-root/runtime/suspense-too-high": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. @@ -744,8 +744,8 @@ describe('instant validation', () => { ) await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered Date.now() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value Date.now() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/suspense-in-root/runtime/invalid-sync-io/page.tsx (8:20) @ Page @@ -763,7 +763,7 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/runtime/invalid-sync-io": Next.js encountered \`Date.now()\` without an explicit rendering intent. + "Error: Route "/suspense-in-root/runtime/invalid-sync-io": Next.js encountered the unstable value \`Date.now()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -771,7 +771,7 @@ describe('instant validation', () => { - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-runtime-current-time at a (app/suspense-in-root/runtime/invalid-sync-io/page.tsx:8:20) @@ -782,7 +782,7 @@ describe('instant validation', () => { 9 | return ( 10 |
11 |

This page uses sync IO after awaiting cookies(): {now}

- Error: Route "/suspense-in-root/runtime/invalid-sync-io": Next.js encountered \`Date.now()\` without an explicit rendering intent. + Error: Route "/suspense-in-root/runtime/invalid-sync-io": Next.js encountered the unstable value \`Date.now()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -790,7 +790,7 @@ describe('instant validation', () => { - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-runtime-current-time at b (app/suspense-in-root/runtime/invalid-sync-io/page.tsx:8:20) @@ -822,8 +822,8 @@ describe('instant validation', () => { ) await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered Date.now() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value Date.now() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/suspense-in-root/runtime/invalid-sync-io-in-runtime-with-valid-static-parent/page.tsx (12:20) @ Page @@ -841,7 +841,7 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-runtime-with-valid-static-parent": Next.js encountered \`Date.now()\` without an explicit rendering intent. + "Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-runtime-with-valid-static-parent": Next.js encountered the unstable value \`Date.now()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -849,7 +849,7 @@ describe('instant validation', () => { - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-runtime-current-time at a (app/suspense-in-root/runtime/invalid-sync-io-in-runtime-with-valid-static-parent/page.tsx:12:20) @@ -860,7 +860,7 @@ describe('instant validation', () => { 13 | return ( 14 |
15 |

Runtime page with sync IO after cookies: {now}

- Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-runtime-with-valid-static-parent": Next.js encountered \`Date.now()\` without an explicit rendering intent. + Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-runtime-with-valid-static-parent": Next.js encountered the unstable value \`Date.now()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -868,7 +868,7 @@ describe('instant validation', () => { - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-runtime-current-time at b (app/suspense-in-root/runtime/invalid-sync-io-in-runtime-with-valid-static-parent/page.tsx:12:20) @@ -879,7 +879,7 @@ describe('instant validation', () => { 13 | return ( 14 |
15 |

Runtime page with sync IO after cookies: {now}

- Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-runtime-with-valid-static-parent": Next.js encountered \`Date.now()\` without an explicit rendering intent. + Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-runtime-with-valid-static-parent": Next.js encountered the unstable value \`Date.now()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -887,7 +887,7 @@ describe('instant validation', () => { - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-runtime-current-time at c (app/suspense-in-root/runtime/invalid-sync-io-in-runtime-with-valid-static-parent/page.tsx:12:20) @@ -925,8 +925,8 @@ describe('instant validation', () => { ) await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered Date.now() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value Date.now() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/suspense-in-root/runtime/invalid-sync-io-after-cache-with-cookie-input/page.tsx (28:20) @ Page @@ -993,8 +993,8 @@ describe('instant validation', () => { ) await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered Date.now() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value Date.now() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/suspense-in-root/runtime/invalid-sync-io-in-generate-metadata/page.tsx (9:20) @ Module.generateMetadata @@ -1012,7 +1012,7 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-generate-metadata": Next.js encountered \`Date.now()\` without an explicit rendering intent. + "Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-generate-metadata": Next.js encountered the unstable value \`Date.now()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -1020,7 +1020,7 @@ describe('instant validation', () => { - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-runtime-current-time at Module.e [as generateMetadata] (app/suspense-in-root/runtime/invalid-sync-io-in-generate-metadata/page.tsx:9:20) @@ -1031,7 +1031,7 @@ describe('instant validation', () => { 10 | return { 11 | title: \`Sync IO in metadata: \${now}\`, 12 | } - Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-generate-metadata": Next.js encountered \`Date.now()\` without an explicit rendering intent. + Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-generate-metadata": Next.js encountered the unstable value \`Date.now()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -1039,7 +1039,7 @@ describe('instant validation', () => { - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-runtime-current-time at Module.e [as generateMetadata] (app/suspense-in-root/runtime/invalid-sync-io-in-generate-metadata/page.tsx:9:20) @@ -1089,8 +1089,8 @@ describe('instant validation', () => { ) await expect(browser).toDisplayCollapsedRedbox(` { - "code": "E1242", - "description": "Next.js encountered Date.now() without an explicit rendering intent.", + "code": "E1261", + "description": "Next.js encountered the unstable value Date.now() while prerendering.", "environmentLabel": "Server", "label": "Instant", "source": "app/suspense-in-root/runtime/invalid-sync-io-in-layout-generate-metadata/layout.tsx (11:20) @ Module.generateMetadata @@ -1108,7 +1108,7 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-layout-generate-metadata": Next.js encountered \`Date.now()\` without an explicit rendering intent. + "Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-layout-generate-metadata": Next.js encountered the unstable value \`Date.now()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -1116,7 +1116,7 @@ describe('instant validation', () => { - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-runtime-current-time at Module.d [as generateMetadata] (app/suspense-in-root/runtime/invalid-sync-io-in-layout-generate-metadata/layout.tsx:11:20) @@ -1127,7 +1127,7 @@ describe('instant validation', () => { 12 | return { 13 | title: \`Layout metadata with sync IO: \${now}\`, 14 | } - Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-layout-generate-metadata": Next.js encountered \`Date.now()\` without an explicit rendering intent. + Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-layout-generate-metadata": Next.js encountered the unstable value \`Date.now()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -1135,7 +1135,7 @@ describe('instant validation', () => { - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-runtime-current-time at Module.d [as generateMetadata] (app/suspense-in-root/runtime/invalid-sync-io-in-layout-generate-metadata/layout.tsx:11:20) @@ -1146,7 +1146,7 @@ describe('instant validation', () => { 12 | return { 13 | title: \`Layout metadata with sync IO: \${now}\`, 14 | } - Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-layout-generate-metadata": Next.js encountered \`Date.now()\` without an explicit rendering intent. + Error: Route "/suspense-in-root/runtime/invalid-sync-io-in-layout-generate-metadata": Next.js encountered the unstable value \`Date.now()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -1154,7 +1154,7 @@ describe('instant validation', () => { - Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call - Prerender and cache the value with \`"use cache"\` - Render the value on the client with \`"use client"\` - - Measure elapsed time with \`performance.now()\` instead of \`Date.now()\` + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-runtime-current-time at Module.d [as generateMetadata] (app/suspense-in-root/runtime/invalid-sync-io-in-layout-generate-metadata/layout.tsx:11:20) @@ -1231,7 +1231,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -1250,7 +1250,7 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/invalid-loading-above-route-group": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/invalid-loading-above-route-group": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. @@ -1295,7 +1295,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -1314,7 +1314,7 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/invalid-dynamic-layout-with-loading": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/invalid-dynamic-layout-with-loading": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. @@ -1372,7 +1372,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -1390,13 +1390,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/blocking-layout/missing-suspense-around-dynamic": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/blocking-layout/missing-suspense-around-dynamic": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -1460,7 +1460,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -1478,13 +1478,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/invalid-blocking-inside-static": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/invalid-blocking-inside-static": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -1521,7 +1521,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -1539,7 +1539,7 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/runtime/invalid-blocking-inside-runtime": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/suspense-in-root/runtime/invalid-blocking-inside-runtime": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. @@ -1585,7 +1585,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -1603,13 +1603,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/missing-suspense-in-parallel-route": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/missing-suspense-in-parallel-route": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -1647,7 +1647,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -1665,13 +1665,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/missing-suspense-in-parallel-route/foo": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/missing-suspense-in-parallel-route/foo": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -1709,7 +1709,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -1727,13 +1727,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/missing-suspense-in-parallel-route/bar": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/missing-suspense-in-parallel-route/bar": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -2362,7 +2362,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1208", + "code": "E1252", "description": "Next.js encountered runtime data in generateViewport().", "environmentLabel": "Server", "label": "Instant", @@ -2386,7 +2386,6 @@ describe('instant validation', () => { Ways to fix this: - Use a static viewport export instead of \`generateViewport()\` - - Wrap your document \`\` in \`\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport @@ -2422,7 +2421,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1210", + "code": "E1255", "description": "Next.js encountered uncached data in generateViewport().", "environmentLabel": "Server", "label": "Instant", @@ -2446,7 +2445,6 @@ describe('instant validation', () => { Ways to fix this: - Cache the viewport data with \`"use cache"\` in \`generateViewport()\` - - Wrap your document \`\` in \`\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport @@ -2520,7 +2518,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1210", + "code": "E1255", "description": "Next.js encountered uncached data in generateViewport().", "environmentLabel": "Server", "label": "Instant", @@ -2544,7 +2542,6 @@ describe('instant validation', () => { Ways to fix this: - Cache the viewport data with \`"use cache"\` in \`generateViewport()\` - - Wrap your document \`\` in \`\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport @@ -2580,7 +2577,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -2598,13 +2595,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/route-group-config-only": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/route-group-config-only": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -2641,7 +2638,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -2659,13 +2656,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/route-group-config-and-segment-config": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/route-group-config-and-segment-config": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -2703,7 +2700,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -2721,13 +2718,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/route-group-segment-config-only": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/route-group-segment-config-only": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -2765,7 +2762,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -2783,13 +2780,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/route-group-config-with-deeper-segment/inner": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/route-group-config-with-deeper-segment/inner": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -2827,7 +2824,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -2845,13 +2842,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/route-group-deeper-segment-config/inner": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/route-group-deeper-segment-config/inner": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -2896,7 +2893,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -2914,13 +2911,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/route-group-shared-boundary": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/route-group-shared-boundary": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -2972,7 +2969,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -2990,13 +2987,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/parallel-group-depths-deep-slot-hole": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/parallel-group-depths-deep-slot-hole": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3042,7 +3039,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -3060,13 +3057,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/parallel-group-depths-shallow-slot-hole": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/parallel-group-depths-shallow-slot-hole": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3113,7 +3110,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -3131,13 +3128,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/runtime/static-layout-above-runtime-config/inner": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/runtime/static-layout-above-runtime-config/inner": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3181,7 +3178,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -3232,7 +3229,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -3250,13 +3247,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/config-depth-preference-slot-wins/deeper/[...rest]": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/config-depth-preference-slot-wins/deeper/[...rest]": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3296,7 +3293,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -3314,13 +3311,13 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/static/config-children-preferred": Next.js encountered runtime data during the initial render or a navigation. + "Error: Route "/suspense-in-root/static/config-children-preferred": Next.js encountered runtime data during prerendering or a navigation. \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. Ways to fix this: - Provide a placeholder with \`\` around the data access - - Use \`generateStaticParams\` to make route params static + - If the runtime data is \`params\` and they're known, prerender them with \`generateStaticParams\` - Set \`export const instant = false\` to allow a blocking route Learn more: https://nextjs.org/docs/messages/blocking-route @@ -3361,7 +3358,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1251", + "code": "E1271", "description": "Next.js encountered runtime data during a navigation.", "environmentLabel": "Server", "label": "Instant", @@ -3646,7 +3643,7 @@ describe('instant validation', () => { ) expect(extractBuildValidationError(result.cliOutput)) .toMatchInlineSnapshot(` - "Error: Route "/suspense-in-root/disable-validation/disable-dev": Next.js encountered uncached data during the initial render or a navigation. + "Error: Route "/suspense-in-root/disable-validation/disable-dev": Next.js encountered uncached data during prerendering or a navigation. \`fetch(...)\` or \`connection()\` accessed outside of \`\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience. @@ -3688,7 +3685,7 @@ describe('instant validation', () => { ], }, ], - "code": "E1249", + "code": "E1264", "description": "Next.js encountered uncached data during a navigation.", "environmentLabel": "Server", "label": "Instant", diff --git a/test/production/app-dir/build-output-prerender/build-output-prerender.test.ts b/test/production/app-dir/build-output-prerender/build-output-prerender.test.ts index f7266425ec6..ebba50bd44c 100644 --- a/test/production/app-dir/build-output-prerender/build-output-prerender.test.ts +++ b/test/production/app-dir/build-output-prerender/build-output-prerender.test.ts @@ -71,13 +71,14 @@ describe('build-output-prerender', () => { if (isTurbopack) { // TODO(veil): Why is the location incomplete unless we enable --no-mangling? expect(getPrerenderOutput(next.cliOutput)).toMatchInlineSnapshot(` - "Error: Route "/client": Next.js encountered \`new Date()\` in a Client Component. + "Error: Route "/client": Next.js encountered the unstable value \`new Date()\` in a Client Component. - This value would be evaluated during the prerender and fixed at build time, instead of recomputed on each visit. + This value would be evaluated during the prerender, instead of recomputed on each visit. Ways to fix this: - Wrap the Client Component in \`\` - Move the read into a \`useEffect\` or event handler + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time-client at (app/client/page.tsx:4:28) @@ -95,13 +96,14 @@ describe('build-output-prerender', () => { `) } else { expect(getPrerenderOutput(next.cliOutput)).toMatchInlineSnapshot(` - "Error: Route "/client": Next.js encountered \`new Date()\` in a Client Component. + "Error: Route "/client": Next.js encountered the unstable value \`new Date()\` in a Client Component. - This value would be evaluated during the prerender and fixed at build time, instead of recomputed on each visit. + This value would be evaluated during the prerender, instead of recomputed on each visit. Ways to fix this: - Wrap the Client Component in \`\` - Move the read into a \`useEffect\` or event handler + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time-client at x () @@ -210,13 +212,14 @@ describe('build-output-prerender', () => { it('shows all prerender errors with readable stacks and code frames', async () => { if (isTurbopack) { expect(getPrerenderOutput(next.cliOutput)).toMatchInlineSnapshot(` - "Error: Route "/client": Next.js encountered \`new Date()\` in a Client Component. + "Error: Route "/client": Next.js encountered the unstable value \`new Date()\` in a Client Component. - This value would be evaluated during the prerender and fixed at build time, instead of recomputed on each visit. + This value would be evaluated during the prerender, instead of recomputed on each visit. Ways to fix this: - Wrap the Client Component in \`\` - Move the read into a \`useEffect\` or event handler + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time-client at Page (app/client/page.tsx:4:28) @@ -228,7 +231,7 @@ describe('build-output-prerender', () => { 6 | To debug the issue, start the app in development mode by running \`next dev\`, then open "/client" in your browser to investigate the error. Error occurred prerendering page "/client". Read more: https://nextjs.org/docs/messages/prerender-error - Error: Route "/server": Next.js encountered \`Math.random()\` without an explicit rendering intent. + Error: Route "/server": Next.js encountered the unstable value \`Math.random()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later. @@ -256,13 +259,14 @@ describe('build-output-prerender', () => { } else { // TODO(veil): Bundler protocols should not appear in stackframes. expect(getPrerenderOutput(next.cliOutput)).toMatchInlineSnapshot(` - "Error: Route "/client": Next.js encountered \`new Date()\` in a Client Component. + "Error: Route "/client": Next.js encountered the unstable value \`new Date()\` in a Client Component. - This value would be evaluated during the prerender and fixed at build time, instead of recomputed on each visit. + This value would be evaluated during the prerender, instead of recomputed on each visit. Ways to fix this: - Wrap the Client Component in \`\` - Move the read into a \`useEffect\` or event handler + - If the value is for telemetry, use a timing API such as \`performance.now()\` Learn more: https://nextjs.org/docs/messages/next-prerender-current-time-client at Page (webpack:///app/client/page.tsx:4:28) @@ -275,7 +279,7 @@ describe('build-output-prerender', () => { 6 | To debug the issue, start the app in development mode by running \`next dev\`, then open "/client" in your browser to investigate the error. Error occurred prerendering page "/client". Read more: https://nextjs.org/docs/messages/prerender-error - Error: Route "/server": Next.js encountered \`Math.random()\` without an explicit rendering intent. + Error: Route "/server": Next.js encountered the unstable value \`Math.random()\` while prerendering. This value can change between renders, so it must be either prerendered or computed later.