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 verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #22 SMP Tue Jan 10 18:39:00 UTC 2023
Binaries:
Node: 16.17.0
npm: 8.15.0
Yarn: 1.22.19
pnpm: 7.1.0
Relevant packages:
next: 13.1.7-canary.10
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
warn - Latest canary version not detected, detected: "13.1.7-canary.10", newest: "13.4.5-canary.4".
Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue
Done in 2.87s.
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
In page.tsx, we have throw Error("Nha!!"); on line 3.
I added global-error.tsx to catch all errors as mentioned in the documentation.
Expected Behavior
If we add error.js, it will work, but it seems that global-error.tsx is not functioning correctly.
From docs (https://nextjs.org/docs/app/building-your-application/routing/error-handling): global-error.js serves as the least granular error UI and can be considered the "catch-all" error handling for the entire application. It is unlikely to be triggered often since root components are typically less dynamic, and other error boundaries defined in error.js will catch most errors.
Even if global-error.js is defined, it is still recommended to define a root error.js file. The fallback component of the root error.js will be rendered within the root layout, which includes globally shared UI and branding.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Version 114.0.5735.90 (Official Build) (64-bit)
The text was updated successfully, but these errors were encountered:
Previously `global-error` only caught the error on client side, this PR adds the support for catching the errors thrown during client components SSR or server components RSC rendering.
Closes#46572Closes#50119Closes#50723
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template-app-dir
To Reproduce
See Code: https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template-app-dir
Describe the Bug
In page.tsx, we have
throw Error("Nha!!");
on line 3.I added
global-error.tsx
to catch all errors as mentioned in the documentation.Expected Behavior
If we add
error.js
, it will work, but it seems thatglobal-error.tsx
is not functioning correctly.From docs (https://nextjs.org/docs/app/building-your-application/routing/error-handling):
global-error.js
serves as the least granular error UI and can be considered the "catch-all" error handling for the entire application. It is unlikely to be triggered often since root components are typically less dynamic, and other error boundaries defined inerror.js
will catch most errors.Even if
global-error.js
is defined, it is still recommended to define a rooterror.js
file. The fallback component of the rooterror.js
will be rendered within the root layout, which includes globally shared UI and branding.Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Version 114.0.5735.90 (Official Build) (64-bit)
The text was updated successfully, but these errors were encountered: