Inconsistent handling of notFound() from server action
Open
Nobody has claimed this yet.
bug
Runtime
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.4k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue
https://github.com/VitaliyPotapov/next-reproduction-app
To Reproduce
npm run devand navigate to http://localhost:3000- click
Form with server action->not-found.tsxis correctly shown - click
Button with server action-> there is uncaught errorNEXT_NOT_FOUND
Current vs. Expected behavior
I except that click on Button with server action would show not-found.tsx.
So that handling of notFound() from server action to be consistent, no matter how I invoke that server action: via form or via click handler.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000
Available memory (MB): 16384
Available CPU cores: 10
Binaries:
Node: 18.20.1
npm: 10.5.0
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 15.0.0-canary.135 // Latest available version is detected (15.0.0-canary.135).
eslint-config-next: N/A
react: 19.0.0-rc-7771d3a7-20240827
react-dom: 19.0.0-rc-7771d3a7-20240827
typescript: 5.3.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Runtime
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked reproduction app by running npm run dev and compare the Form with server action and Button with server action flows. Trace how each invokes notFound() and verify that the button path also renders not-found.tsx without an uncaught NEXT_NOT_FOUND error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, next.js, react
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100