nextjs - ✅(Solved) Fix Server Action POST returns `text/html` PPR shell instead of RSC payload after upgrading to 16.2.0 [4 pull requests, 5 comments, 6 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#91662Fetched 2026-04-08 01:02:38
View on GitHub
Comments
5
Participants
6
Timeline
24
Reactions
4
Author
Assignees
Timeline (top)
commented ×5referenced ×5cross-referenced ×4labeled ×3

Fix Action

Fixed

PR fix notes

PR #91669: fix : server actions POST to return RSC payload

Description (problem / solution / changelog)

What?

  • Fix Server Action POST to return RSC payload, not HTML.

Why?

  • 16.2.0 could return HTML for action POST in PPR + cacheComponents, causing E394.

How?

  • Treat possible Server Action requests as RSC in app page response handling.

Fixes : #91662

Changed files

  • packages/next/src/build/templates/app-page.ts (modified, +6/-4)

PR #91677: fix(next): prevent cached fallback shell from intercepting server actions on dynamic routes

Description (problem / solution / changelog)

Fixing a Bug

What?

When cacheComponents is enabled, the build creates fallbackRouteParams for dynamic routes. This caused the fallback shell serving path in app-page.ts to trigger for server action POST requests, returning the prerendered HTML instead of executing the action. The condition at line 1076 now checks !isPossibleServerAction to skip the fallback shell for action requests.

Fixes #91662

Changed files

  • packages/next/src/build/templates/app-page.ts (modified, +1/-0)
  • test/e2e/app-dir/cache-components/app/server-action-dynamic/[[...slug]]/action.ts (added, +5/-0)
  • test/e2e/app-dir/cache-components/app/server-action-dynamic/[[...slug]]/page.tsx (added, +27/-0)
  • test/e2e/app-dir/cache-components/cache-components.server-action.test.ts (modified, +33/-0)

PR #91711: Fix server actions in standalone mode with cacheComponents

Description (problem / solution / changelog)

The staticPathKey condition added in #91231 inadvertently applies to server action requests on dynamic SSG routes when cacheComponents is enabled.

Server action fetch requests from the client do not send the RSC header (rsc: 1). They only send Accept: text/x-component and the Next-Action header. This means isRSCRequest and isDynamicRSCRequest are both false for action requests. The new staticPathKey condition (isSSG && pageIsDynamic && prerenderInfo?.fallbackRouteParams) evaluates to true for dynamic PPR routes, setting staticPathKey even though ssgCacheKey is null for actions.

With staticPathKey set, the request enters the fallback rendering block, which serves the cached fallback HTML shell with the action result appended to it, instead of responding with just the RSC action result.

The fix excludes server action requests from the staticPathKey computation by adding !isPossibleServerAction to the condition, restoring the pre-#91231 behavior where staticPathKey was always null for server actions in production.

fixes #91662 closes #91677 closes #91669

Changed files

  • packages/next/src/build/templates/app-page.ts (modified, +8/-1)
  • test/production/standalone-mode/server-actions/app/[slug]/form.tsx (added, +57/-0)
  • test/production/standalone-mode/server-actions/app/[slug]/page.tsx (added, +22/-0)
  • test/production/standalone-mode/server-actions/app/layout.tsx (added, +11/-0)
  • test/production/standalone-mode/server-actions/build-local.sh (added, +12/-0)
  • test/production/standalone-mode/server-actions/next.config.ts (added, +7/-0)
  • test/production/standalone-mode/server-actions/public/favicon.ico (added, +0/-0)
  • test/production/standalone-mode/server-actions/standalone-mode-server-actions.test.ts (added, +76/-0)

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
Binaries:
  Node: 22.15.0
Relevant Packages:
  next: 16.2.0 (works on 16.1.7)
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: standalone
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/mariusch/nextjs-sa-ppr-repro

To Reproduce

  1. next.config.ts: set output: "standalone" and cacheComponents: true
  2. Create a dynamic route with a <Suspense> boundary (so PPR activates) and a Server Action
  3. next build && node .next/standalone/server.js
  4. Invoke the Server Action
  5. Response is an HTML prerender shell instead of RSC payload → client throws E394

Current vs. Expected behavior

Server Action POST response headers after upgrading 16.1.7 → 16.2.0:

Header16.1.716.2.0
content-typetext/x-componenttext/html; charset=utf-8
x-nextjs-postponedabsent1
x-nextjs-cacheHITabsent

Both include x-nextjs-prerender: 1. Request includes Next-Action header in both cases.

Expected: Returns text/x-component with RSC payload. Actual: Returns PPR HTML shell. Action executes, but client can't parse the response → E394.

Downgrading to 16.1.7 resolves it.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
Binaries:
  Node: 22.15.0
Relevant Packages:
  next: 16.2.0 (works on 16.1.7)
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: standalone

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

cacheComponents, Server Actions, Partial Prerendering (PPR)

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

Other (Deployed), next start (local)

Additional context

Self-hosted via Docker (node:25-alpine), not Vercel. Azure Front Door in front but unchanged between versions.

extent analysis

Fix Plan

The fix involves downgrading Next.js to version 16.1.7, as the issue is resolved in this version.

  • Run the following command to downgrade Next.js:

npm install [email protected]

* Alternatively, you can use yarn:
  ```bash
yarn add [email protected]
  • After downgrading, rebuild and restart your application:

next build && node .next/standalone/server.js


### Verification
To verify that the fix worked, check the response headers of the Server Action POST request. The `content-type` header should be `text/x-component`, and the response body should contain the RSC payload.

### Extra Tips
* Keep an eye on the Next.js changelog and release notes for any updates related to Server Actions and Partial Prerendering (PPR).
* If you're using a self-hosted setup via Docker, ensure that your Docker image is updated to reflect the changed Next.js version.
* Consider setting up automated tests to catch any regressions in future updates.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING