Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

global-error.tsx does not catch errors thrown during SSR #52993

Open
1 task done
subalee opened this issue Jul 21, 2023 · 7 comments
Open
1 task done

global-error.tsx does not catch errors thrown during SSR #52993

subalee opened this issue Jul 21, 2023 · 7 comments
Labels
bug Issue was opened via the bug report template.

Comments

@subalee
Copy link

subalee commented Jul 21, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.1.0: Sun Oct  9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000
    Binaries:
      Node: 16.19.0
      npm: 8.19.3
      Yarn: 1.22.19
      pnpm: 8.6.2
    Relevant Packages:
      next: 13.4.11
      eslint-config-next: 13.1.0
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 4.9.4
    Next.js Config:
      output: N/A

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://github.com/subalee/app-playground/tree/global-err-not-working

To Reproduce

Describe the Bug

a global-error.tsx file exists
an error is thrown inside a fetch function which is awaited inside a nested layout.

The global error boundary does not catch the error
image

Expected Behavior

global-error.tsx catches errors thrown during SSR

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@subalee subalee added the bug Issue was opened via the bug report template. label Jul 21, 2023
@subalee
Copy link
Author

subalee commented Jul 21, 2023

Probably related to: #52573

@KristineTrona
Copy link

Same issue for me, the global-error.tsx also does not catch any errors thrown inside the root layout. I'm on v.13.4.10

@mike667
Copy link

mike667 commented Jul 30, 2023

Same issue for me, I've tried client errors or server errors but global-error.tsx doesn't work. I copied example from docs. I don't understand in switch cases global-error.tsx will work.

I want to catch errors in my root layout, because I have some login there with data fetching. For another components and pages error.tsx works as expected.

@yanv1991
Copy link

yanv1991 commented Sep 15, 2023

is this already fixed? I'm in 13.4.12 and still see the issue even defining global error and error 🤔

@icazemier

This comment has been minimized.

@Innei
Copy link

Innei commented Oct 27, 2023

Any progress?

@boochamoocha
Copy link

I have the same behavior in next/14.0.3-canary.2
global-error.tsx never triggers when throw an error in a root layout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

7 participants