vercel / next.js

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

notFound function incorrectly triggers error overlay in Next.js 15 #71639

Closed aramikuto closed 3 hours ago

aramikuto commented 5 hours ago

Link to the code that reproduces this issue

https://github.com/aramikuto/nextjs-15-not-found-error-overlay

To Reproduce

  1. Start the application in development (yarn dev)
  2. Open the homepage at http://localhost:3000

Current vs. Expected behavior

Expected behavior:

A 404 page should be displayed without any additional errors.

Current behavior:

The 404 page is displayed, but the error overlay is triggered as well. The error overlay should not be triggered since the notFound function is being intentionally used to display the 404 page.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.0.0: Tue Sep 24 23:36:26 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 18.19.0
  npm: 10.2.3
  Yarn: 1.22.22
  pnpm: 8.14.3
Relevant Packages:
  next: 15.0.1-canary.1 // Latest available version is detected (15.0.1-canary.1).
  eslint-config-next: N/A
  react: 19.0.0-beta-04b058868c-20240508
  react-dom: 19.0.0-beta-04b058868c-20240508
  typescript: 5.1.3
Next.js Config:
  output: N/A

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

Navigation

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

next dev (local)

Additional context

Error content:

[ Server ] Error: NEXT_NOT_FOUND

The above error occurred in the component.

React will try to recreate this component tree from scratch using the error boundary you provided, NotFoundErrorBoundary.

theoludwig commented 4 hours ago

I think this is fixed by: #71583

aramikuto commented 3 hours ago

@theoludwig thank you for pointing this out. I checked the new canary version (v15.0.1-canary.2), and the error is no longer present. I’ll go ahead and close this issue since it's been resolved.