Commit 3639b6a0 authored by Matt Mastracci's avatar Matt Mastracci

Fix Node.js streams: don't pass waitForAllReady in prerenderToStream

The prerenderToStream legacy path was passing { waitForAllReady: true }
to renderFizzStream, which was added in #92513. With Node.js streams
enabled, renderToNodeFizzStream defers pipeable.pipe() to onAllReady,
but the pipeable was already being piped by an earlier callback, causing
React to throw "only supports piping to one writable stream".

The web stream path ignores this option (it's a no-op), which is why
the bug only manifests with __NEXT_USE_NODE_STREAMS=true.

Remove { waitForAllReady: true } from both the main and error Fizz
render calls in prerenderToStream. The prerender path already handles
stream completion separately.

Fixes production builds failing on /_not-found when the root layout
wraps children in <Suspense>.
parent 8298079a
......@@ -8286,8 +8286,7 @@ async function prerenderToStream(
onError: htmlRendererErrorHandler,
nonce,
bootstrapScripts: [bootstrapScript],
},
{ waitForAllReady: true }
}
)
if (shouldGenerateStaticFlightData(workStore)) {
......@@ -8498,8 +8497,7 @@ async function prerenderToStream(
nonce,
bootstrapScripts: [errorBootstrapScript],
formState,
},
{ waitForAllReady: true }
}
)
const resolvedFlightResult = errorFlightResultPromise
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment