You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe that what you're seeing is caused by a React behavior, not anything Next.js-specific: https://github.com/reactjs/rfcs/blob/ba9bd5744cb922184ec9390515910cd104a30c6e/text/0215-server-errors-in-react-18.md
If an error occurs on the server, react will skip SSR up to the nearest suspense boundary, and retry rendering on the client. but rendering a <script> doesn't work there like it does in SSR (and, i believe, neither does <Script strategy="beforeInteractive">) -- it will get inserted, but not actually run, which is what we're seeing in your case.
This can be fixed by adding a loading.tsx alongside the page that is erroring, which will stop the error from "bubbling up" above the layout.
See also #62228 (comment) about error boundaries not being SSRed -- it's a similar issue, because internally, notFound throws an error that gets caught by a boundary.
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Link to the code that reproduces this issue
https://github.com/HofmannZ/reproduction-app
To Reproduce
pnpm build
pnpm start
localhost:3000/page-with-error
Current vs. Expected behavior
Current Situation: I only see the error in the console.
Expected Behavior: I would expect to see logs saying
I am a log
andI am another log
from the layout, even in the presence of an error on the page.When you navigate to
localhost:3000/
, the logs do appear as this page does not trigger an error.Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020 Binaries: Node: 20.12.0 npm: 10.5.0 Yarn: N/A pnpm: 8.15.6 Relevant Packages: next: 14.1.4 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: N/A Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
App Router
Which stage(s) are affected? (Select all that apply)
next start (local)
Additional context
No response
The text was updated successfully, but these errors were encountered: