vercel / vercel/next.js

Inconsistent handling of notFound() from server action

Open
#69,480 1 comment 0 reactions 0 assignees View on GitHub

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
  1. npm run dev and navigate to http://localhost:3000
  2. click Form with server action -> not-found.tsx is correctly shown
  3. click Button with server action -> there is uncaught error NEXT_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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.