-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Closed
Labels
MiddlewareRelated to Next.js Middleware.Related to Next.js Middleware.bugIssue was opened via the bug report template.Issue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.locked
Description
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/jolly-taussig-tzm55f
To Reproduce
- View the repro CodeSandbox
- Try to visit any page that has a invalid url
- Notice the 500 error.
Current vs. Expected behavior
I would expect the custom 404 template to be displayed, instead a 500 error is thrown. This only seems to happen if a Middleware file is present. This seemed to start with v14.2.7.
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Sun Aug 6 20:05:33 UTC 2023
Available memory (MB): 4102
Available CPU cores: 2
Binaries:
Node: 20.9.0
npm: 9.8.1
Yarn: 1.22.19
pnpm: 8.10.2
Relevant Packages:
next: 14.2.7 // Latest available version is detected (14.2.7).
eslint-config-next: N/A
react: 18.3.1
react-dom: 18.3.1
typescript: 5.1.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Middleware
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), Other (Deployed)
Additional context
No response
mauricedb, r34son, atissedrescaleway and PedramAbd
Metadata
Metadata
Assignees
Labels
MiddlewareRelated to Next.js Middleware.Related to Next.js Middleware.bugIssue was opened via the bug report template.Issue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.locked