vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.93k stars 26.87k forks source link

Global error not working if triggered in sub-path in version 13.5.5 #67893

Open TitusEfferian opened 3 months ago

TitusEfferian commented 3 months ago

Link to the code that reproduces this issue

https://github.com/TitusEfferian/next-13-3-5-error-repro/blob/main/src/app/TestLayoutChild.tsx

To Reproduce

  1. Clone the repository: https://github.com/TitusEfferian/next-13-3-5-error-repro
  2. Run npm install
  3. Run npm run build
  4. Run npm run start
  5. Go to http://localhost:3000/another_path
  6. Click the trigger error button

Current vs. Expected behavior

Current Behavior

It's not handled by the global error; instead, it is rendered by the default error UI from Next.js.

Expected Behavior

Handled by the global error if the error comes from a sub-path.

Actually, if the error is triggered on the root page, it works as expected, but if it's triggered by another path, it's not working.

I also checked with the later version 14.2.5, and it works in that version.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.5.0: Wed May  1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020
  Available memory (MB): 32768
  Available CPU cores: 10
Binaries:
  Node: 18.19.1
  npm: 10.2.4
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 14.2.5 // Latest available version is detected (14.2.5).
  eslint-config-next: 13.5.5
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.5.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure, create-next-app

Which stage(s) are affected? (Select all that apply)

next build (local), next start (local)

Additional context

No response

AliRazaDev27 commented 2 months ago

The version of next in you repo (14.2.5) does not match the version i n bug report (13.5.5) , also the repo does not reproduce the behavior described in the bug report (because of version), review your repo first.

TitusEfferian commented 2 months ago

done updating @AliRazaDev27