Fix Server Actions hanging after navigation to PPR pages (#99252)
Adopts #99229. Closes #99229.
A Server Action can hang on Vercel when the client navigates from `/a`
to a PPR `/b` page and then calls an action owned by `/a`. The `/b` POST
can carry postponed state. `app-page-runtime.ts` consumes the request
stream to separate that state and saves the remaining action body as
`actionBody`. The forwarding path reads `req.stream()` again, so its
fetch waits on an exhausted stream until the function times out.
The forwarding path now sends `actionBody` when it is present. It
removes the source route's resume headers because the forwarded body no
longer contains that state; the platform can attach the target route's
state on the new request. Requests without a saved action body still use
the request stream.
The E2E test uses `connection()` to make `/b` PPR, warms its shell,
navigates from `/a` to `/b`, and invokes an action imported only by
`/a`. On a fresh Vercel deployment, it stays pending without this change
and returns `pong` with it. The same test passes under `next start`,
which does not receive the platform's prepended state.
Fixes #99153
---------
Co-authored-by:
Dmitrii Troitskii <jsleitor@gmail.com>
Showing
Please
register
or
sign in
to comment