cloudflare / cloudflare/vinext
[nextjs-tracker] Return 400/409 for unrecognized Server Actions
- Dominant language
- TypeScript
- Stars
- 8.8k
- Forks
- 406
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 120
Description
## Next.js Change
**Commit:** [`65c832c`](https://github.com/vercel/next.js/commit/65c832c8b87963c3d6cc371b8909b9281868d473)
**PR:** [#98123](https://github.com/vercel/next.js/pull/98123)
## What changed
Next.js now rejects unrecognized Server Action requests with client errors instead of treating them as missing pages or internal failures. A malformed Server Action ID returns `400 Bad Request` with `Invalid Server Action request.`; a well-formed ID absent from the current deployment, including deployment skew, returns `409 Conflict` with `Server Action unavailable.` The classification applies to `Next-Action` fetch requests, multipart MPA forms, direct and bound actions, and forwarded actions.
## Impact on vinext
vinext implements Server Actions and should match this transport-independent error contract. Without it, malformed or stale action requests can return incorrect `404` or `500` responses and expose inconsistent behavior between fetch actions and progressive-enhancement form submissions.
## Acceptance criteria
- [ ] Return `400 Bad Request` and the generic `Invalid Server Action request.` text response for malformed Server Action IDs.
- [ ] Return `409 Conflict` and the generic `Server Action unavailable.` text response for well-formed IDs unavailable in the current deployment.
- [ ] Apply the classifications consistently to `Next-Action` fetch requests and multipart MPA forms, including direct and bound actions.
- [ ] Preserve the client error classification for forwarded Server Action responses.
- [ ] Add coverage for malformed and unavailable IDs in the relevant supported runtimes.
## Related
- Upstream coverage: `test/e2e/app-dir/actions-unrecognized/actions-unrecognized.test.ts`
- Upstream coverage: `test/e2e/app-dir/no-server-actions/no-server-actions.test.ts`
Contributor guide
Research direction
Start by reading the upstream coverage in test/e2e/app-dir/actions-unrecognized/actions-unrecognized.test.ts and test/e2e/app-dir/no-server-actions/no-server-actions.test.ts, then trace vinext's Server Actions handling for Next-Action fetches, multipart MPA forms, direct and bound actions, and forwarded responses. Done means malformed IDs consistently return 400, unavailable well-formed IDs return 409, and relevant runtime tests cover these cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100