Skip to content

Fix Node.js streams: remove waitForAllReady from prerenderToStream#92843

Closed
mmastrac wants to merge 1 commit into
canaryfrom
mmastrac/fix-node-streams-prerender
Closed

Fix Node.js streams: remove waitForAllReady from prerenderToStream#92843
mmastrac wants to merge 1 commit into
canaryfrom
mmastrac/fix-node-streams-prerender

Conversation

@mmastrac
Copy link
Copy Markdown
Contributor

What

Remove { waitForAllReady: true } from the two renderFizzStream calls in prerenderToStream's legacy path.

Why

PR #92513 added { waitForAllReady: true } to these Fizz render calls when switching them from renderToWebFizzStream to the conditional renderFizzStream. With __NEXT_USE_NODE_STREAMS=true, renderToNodeFizzStream defers pipeable.pipe() to onAllReady, but the pipeable was already piped, causing React to throw:

Error: React currently only supports piping to one writable stream.

The web stream path ignores waitForAllReady (the parameter is _options), which is why this only manifests with Node.js streams enabled.

The prerender path already handles stream completion separately, so waitForAllReady is unnecessary here.

Reproduction

__NEXT_USE_NODE_STREAMS=true NEXT_SKIP_ISOLATE=1 NEXT_TEST_MODE=start \
  pnpm testheadless test/e2e/app-dir/metadata-suspense/index.test.ts

Fails with "React currently only supports piping to one writable stream" on /_not-found prerender. Any app with a root layout that wraps children in <Suspense> is affected.

Test plan

  • metadata-suspense test passes with __NEXT_USE_NODE_STREAMS=true
  • missing-suspense-with-csr-bailout "should pass build" test passes with __NEXT_USE_NODE_STREAMS=true
  • Both tests still pass without __NEXT_USE_NODE_STREAMS
  • CI passes

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>.
@nextjs-bot
Copy link
Copy Markdown
Contributor

nextjs-bot commented Apr 15, 2026

Failing test suites

Commit: 3639b6a | About building and testing Next.js

pnpm test test/integration/rewrites-manual-href-as/test/index.test.ts (turbopack) (job)

  • rewrites manual href/as > production mode > should allow manual href/as on index page (DD)
Expand output

● rewrites manual href/as › production mode › should allow manual href/as on index page

expect(received).toBeTruthy()

Received: false

  28 |
  29 |     expect(await browser.elementByCss('#index').text()).toBe('index page')
> 30 |     expect(await browser.hasElementByCssSelector('#modal')).toBeTruthy()
     |                                                             ^
  31 |     expect(await browser.eval('window.beforeNav')).toBe(1)
  32 |     expect(JSON.parse(await browser.elementByCss('#query').text())).toEqual({
  33 |       imageId: '123',

  at Object.toBeTruthy (integration/rewrites-manual-href-as/test/index.test.ts:30:61)

pnpm test-start test/e2e/app-dir/metadata-static-generation/metadata-static-generation.test.ts (job)

  • app-dir - metadata-static-generation > should contain async generated metadata in head for simple static page (DD)
  • app-dir - metadata-static-generation > should contain async generated metadata in head static page with suspenseful content (DD)
Expand output

● app-dir - metadata-static-generation › should contain async generated metadata in head for simple static page

expect(received).toBe(expected) // Object.is equality

Expected: "index page"
Received: ""

  34 |     it('should contain async generated metadata in head for simple static page', async () => {
  35 |       const $ = await next.render$('/')
> 36 |       expect($(`${rootSelector} title`).text()).toBe('index page')
     |                                                 ^
  37 |       expect(
  38 |         $(`${rootSelector} meta[name="description"]`).attr('content')
  39 |       ).toBe('index page description')

  at Object.toBe (e2e/app-dir/metadata-static-generation/metadata-static-generation.test.ts:36:49)

● app-dir - metadata-static-generation › should contain async generated metadata in head static page with suspenseful content

expect(received).toBe(expected) // Object.is equality

Expected: "suspenseful page - static"
Received: ""

  42 |     it('should contain async generated metadata in head static page with suspenseful content', async () => {
  43 |       const $ = await next.render$('/suspenseful/static')
> 44 |       expect($(`${rootSelector} title`).text()).toBe(
     |                                                 ^
  45 |         'suspenseful page - static'
  46 |       )
  47 |     })

  at Object.toBe (e2e/app-dir/metadata-static-generation/metadata-static-generation.test.ts:44:49)

pnpm test-start test/e2e/app-dir/metadata-streaming-static-generation/metadata-streaming-static-generation.test.ts (job)

  • app-dir - metadata-streaming-static-generation > static pages (production) > should contain async generated metadata in head for simple static page (DD)
  • app-dir - metadata-streaming-static-generation > static pages (production) > should contain async generated metadata in head for slow static page (DD)
  • app-dir - metadata-streaming-static-generation > static pages (production) > should contain async generated metadata in head static page with suspenseful content (DD)
Expand output

● app-dir - metadata-streaming-static-generation › static pages (production) › should contain async generated metadata in head for simple static page

expect(received).toBe(expected) // Object.is equality

Expected: "index page"
Received: ""

  53 |         it('should contain async generated metadata in head for simple static page', async () => {
  54 |           const $ = await next.render$('/')
> 55 |           expect($('head title').text()).toBe('index page')
     |                                          ^
  56 |         })
  57 |
  58 |         it('should contain async generated metadata in head for slow static page', async () => {

  at Object.toBe (e2e/app-dir/metadata-streaming-static-generation/metadata-streaming-static-generation.test.ts:55:42)

● app-dir - metadata-streaming-static-generation › static pages (production) › should contain async generated metadata in head for slow static page

expect(received).toBe(expected) // Object.is equality

Expected: "slow page - static"
Received: ""

  58 |         it('should contain async generated metadata in head for slow static page', async () => {
  59 |           const $ = await next.render$('/slow/static')
> 60 |           expect($('head title').text()).toBe('slow page - static')
     |                                          ^
  61 |         })
  62 |
  63 |         it('should contain async generated metadata in head static page with suspenseful content', async () => {

  at Object.toBe (e2e/app-dir/metadata-streaming-static-generation/metadata-streaming-static-generation.test.ts:60:42)

● app-dir - metadata-streaming-static-generation › static pages (production) › should contain async generated metadata in head static page with suspenseful content

expect(received).toBe(expected) // Object.is equality

Expected: "suspenseful page - static"
Received: ""

  63 |         it('should contain async generated metadata in head static page with suspenseful content', async () => {
  64 |           const $ = await next.render$('/suspenseful/static')
> 65 |           expect($('head title').text()).toBe('suspenseful page - static')
     |                                          ^
  66 |         })
  67 |       })
  68 |     }

  at Object.toBe (e2e/app-dir/metadata-streaming-static-generation/metadata-streaming-static-generation.test.ts:65:42)

@nextjs-bot
Copy link
Copy Markdown
Contributor

Stats from current PR

✅ No significant changes detected

📊 All Metrics
📖 Metrics Glossary

Dev Server Metrics:

  • Listen = TCP port starts accepting connections
  • First Request = HTTP server returns successful response
  • Cold = Fresh build (no cache)
  • Warm = With cached build artifacts

Build Metrics:

  • Fresh = Clean build (no .next directory)
  • Cached = With existing .next directory

Change Thresholds:

  • Time: Changes < 50ms AND < 10%, OR < 2% are insignificant
  • Size: Changes < 1KB AND < 1% are insignificant
  • All other changes are flagged to catch regressions

⚡ Dev Server

Metric Canary PR Change Trend
Cold (Listen) 455ms 455ms █▁█▁▁
Cold (Ready in log) 442ms 444ms ▅▄▅▂▅
Cold (First Request) 1.122s 1.133s ▁▁▁█▁
Warm (Listen) 457ms 457ms ▅▁▁▅▁
Warm (Ready in log) 445ms 447ms ▃▃▃▃▄
Warm (First Request) 341ms 345ms ▁▃▃▂▄
📦 Dev Server (Webpack) (Legacy)

📦 Dev Server (Webpack)

Metric Canary PR Change Trend
Cold (Listen) 456ms 456ms ▁▅▅▅▅
Cold (Ready in log) 441ms 442ms ▃▃▃▂▂
Cold (First Request) 1.888s 1.884s ▄▅▂▅▃
Warm (Listen) 456ms 457ms █▅▅▅█
Warm (Ready in log) 442ms 442ms ▃▃▃▂▂
Warm (First Request) 1.910s 1.899s ▄▄▁▅▃

⚡ Production Builds

Metric Canary PR Change Trend
Fresh Build 3.868s 3.934s ▅▅▂▁▃
Cached Build 3.939s 3.910s ▅▅▂▁▄
📦 Production Builds (Webpack) (Legacy)

📦 Production Builds (Webpack)

Metric Canary PR Change Trend
Fresh Build 14.562s 14.494s ▃▄▄▃▂
Cached Build 14.671s 14.668s ▃▃▂▃▁
node_modules Size 493 MB 493 MB █████
📦 Bundle Sizes

Bundle Sizes

⚡ Turbopack

Client

Main Bundles
Canary PR Change
053b9v5j96uu_.js gzip 8.56 kB N/A -
07rxhp_1_g4mu.js gzip 13.1 kB N/A -
096aa2uod0_wa.js gzip 9.82 kB N/A -
0cz1d0mv5g_q7.js gzip 39.4 kB 39.4 kB
0ea8vo2o6kp_s.js gzip 13.3 kB N/A -
0egovw6-5i1e3.js gzip 8.57 kB N/A -
0fli3_wppnim5.js gzip 12.9 kB N/A -
0gkovryjv05n3.js gzip 154 B N/A -
0ho78l23ixdy7.js gzip 155 B N/A -
0jrg8yoqn4b8e.js gzip 155 B N/A -
0k09jwjeb-tki.js gzip 13.8 kB N/A -
0kb7_ep3r1z0_.js gzip 10.1 kB N/A -
0kmgih16pb2zy.js gzip 9.24 kB N/A -
0lbv96yr1uj-x.js gzip 168 B N/A -
0wxpyd8r-vipl.js gzip 1.47 kB N/A -
1-z_xm7pzpbeh.js gzip 49.2 kB N/A -
11qa6mv6j4f0n.js gzip 160 B N/A -
16lhqjoqbznyg.js gzip 220 B 220 B
16vepdkipri3r.js gzip 8.51 kB N/A -
17n96uu6y1pxq.js gzip 8.6 kB N/A -
1d9ms1y2nit5w.js gzip 65.5 kB N/A -
1elt1qium-r2m.css gzip 115 B 115 B
1odlz7_bqi4gv.js gzip 160 B N/A -
1s-lssnhdqk31.js gzip 156 B N/A -
1xz7fhgdco-x_.js gzip 8.59 kB N/A -
2__-e_ym8n788.js gzip 450 B N/A -
22o6xd9_ywdu6.js gzip 233 B N/A -
2avcdi72oetam.js gzip 156 B N/A -
2h9_xc-4i5_oy.js gzip 152 B N/A -
2k1q_gre6hp0-.js gzip 8.56 kB N/A -
2kvj8yrfznmwx.js gzip 5.69 kB N/A -
2sgqisp4604si.js gzip 8.51 kB N/A -
2u7io78pjtekk.js gzip 156 B N/A -
3_lh2q04233ur.js gzip 70.8 kB N/A -
342ijzvrpe53h.js gzip 2.29 kB N/A -
3p575fh88tejl.js gzip 155 B N/A -
3v9s-fz24f8oo.js gzip 10.4 kB N/A -
3zdh_rd16s0i8.js gzip 157 B N/A -
420pn_b9x-3ir.js gzip 8.62 kB N/A -
43l229j-6khv5.js gzip 156 B N/A -
44un3--wmqiyh.js gzip 7.61 kB N/A -
turbopack-0x..2c1o.js gzip 4.19 kB N/A -
turbopack-0y..rjc9.js gzip 4.2 kB N/A -
turbopack-1k..rbj5.js gzip 4.19 kB N/A -
turbopack-1q.._m7g.js gzip 4.19 kB N/A -
turbopack-2-..4mlc.js gzip 4.17 kB N/A -
turbopack-22..h7oj.js gzip 4.19 kB N/A -
turbopack-25..lf2b.js gzip 4.19 kB N/A -
turbopack-2b..nby5.js gzip 4.19 kB N/A -
turbopack-2m..wm_6.js gzip 4.19 kB N/A -
turbopack-2n.._pfr.js gzip 4.19 kB N/A -
turbopack-3b..ydgx.js gzip 4.19 kB N/A -
turbopack-3e..0ajm.js gzip 4.19 kB N/A -
turbopack-3l..dvr5.js gzip 4.19 kB N/A -
turbopack-3m..qy5_.js gzip 4.19 kB N/A -
03_szppy5nakp.js gzip N/A 49.2 kB -
0arkbdqpxc37i.js gzip N/A 8.6 kB -
0iuamvde1mkye.js gzip N/A 166 B -
0mz-rbiau93_g.js gzip N/A 161 B -
0tvekitj587fh.js gzip N/A 8.51 kB -
0vcsfpshdbpoi.js gzip N/A 157 B -
0z83a1om5rvtt.js gzip N/A 7.61 kB -
1-jqyfc89tixo.js gzip N/A 1.46 kB -
14t1kneseb8th.js gzip N/A 2.3 kB -
16bh0aqv641xv.js gzip N/A 157 B -
192q2suy7rwb_.js gzip N/A 8.56 kB -
1ab2xruymo-oj.js gzip N/A 449 B -
1im7xphq6dxob.js gzip N/A 159 B -
1ng_99sotnhzq.js gzip N/A 159 B -
1qui_nsqw5190.js gzip N/A 157 B -
1wzrm0xjjbzn5.js gzip N/A 10.1 kB -
25a1yz7zua29z.js gzip N/A 13.8 kB -
2f2bp_kexa37v.js gzip N/A 13.3 kB -
2fpb7l1pbce6e.js gzip N/A 65.5 kB -
2i5v1taq97gql.js gzip N/A 8.59 kB -
2jrvadyrjp0yr.js gzip N/A 155 B -
2n3vh0w0tnb_2.js gzip N/A 8.52 kB -
2u_rpxq3tzytl.js gzip N/A 233 B -
2wfbykz1avdns.js gzip N/A 8.56 kB -
32sifemopndov.js gzip N/A 10.4 kB -
368lim5wq0o0r.js gzip N/A 12.9 kB -
37ba9t8u6k_9f.js gzip N/A 156 B -
3aouhp_o4j3ta.js gzip N/A 151 B -
3de283pazbu99.js gzip N/A 9.81 kB -
3drqjohogojbw.js gzip N/A 5.69 kB -
3g8l1m2-o-ewi.js gzip N/A 13.1 kB -
3gp2o_v7jcw6s.js gzip N/A 8.57 kB -
3kab57ds4zwc9.js gzip N/A 157 B -
3qu7g1q2l_x2n.js gzip N/A 9.24 kB -
3vucw_kkxf-6j.js gzip N/A 155 B -
3zycucbo0ee-y.js gzip N/A 70.8 kB -
41p1znhcs5rk8.js gzip N/A 155 B -
43j6fjudq0a3_.js gzip N/A 8.62 kB -
turbopack-02..ejcf.js gzip N/A 4.19 kB -
turbopack-04..36zk.js gzip N/A 4.19 kB -
turbopack-05..ed1i.js gzip N/A 4.19 kB -
turbopack-08..ymqg.js gzip N/A 4.19 kB -
turbopack-1e..75yv.js gzip N/A 4.17 kB -
turbopack-1e..lwrg.js gzip N/A 4.19 kB -
turbopack-1s..5095.js gzip N/A 4.19 kB -
turbopack-1w..leed.js gzip N/A 4.19 kB -
turbopack-1x..h7hw.js gzip N/A 4.19 kB -
turbopack-29..nv35.js gzip N/A 4.19 kB -
turbopack-2d..42om.js gzip N/A 4.2 kB -
turbopack-3f..ewzo.js gzip N/A 4.19 kB -
turbopack-3m..3yye.js gzip N/A 4.19 kB -
turbopack-3z..lv_i.js gzip N/A 4.19 kB -
Total 465 kB 465 kB ⚠️ +39 B

Server

Middleware
Canary PR Change
middleware-b..fest.js gzip 715 B 718 B
Total 715 B 718 B ⚠️ +3 B
Build Details
Build Manifests
Canary PR Change
_buildManifest.js gzip 434 B 429 B 🟢 5 B (-1%)
Total 434 B 429 B ✅ -5 B

📦 Webpack

Client

Main Bundles
Canary PR Change
2637-HASH.js gzip 4.63 kB N/A -
7724.HASH.js gzip 169 B N/A -
8274-HASH.js gzip 61.3 kB N/A -
8817-HASH.js gzip 5.59 kB N/A -
c3500254-HASH.js gzip 62.8 kB N/A -
framework-HASH.js gzip 59.7 kB 59.7 kB
main-app-HASH.js gzip 254 B 255 B
main-HASH.js gzip 39.4 kB 39.4 kB
webpack-HASH.js gzip 1.68 kB 1.68 kB
5887-HASH.js gzip N/A 5.61 kB -
6522-HASH.js gzip N/A 60.7 kB -
6779-HASH.js gzip N/A 4.63 kB -
8854.HASH.js gzip N/A 169 B -
eab920f9-HASH.js gzip N/A 62.8 kB -
Total 235 kB 235 kB ✅ -619 B
Polyfills
Canary PR Change
polyfills-HASH.js gzip 39.4 kB 39.4 kB
Total 39.4 kB 39.4 kB
Pages
Canary PR Change
_app-HASH.js gzip 193 B 193 B
_error-HASH.js gzip 182 B 182 B
css-HASH.js gzip 333 B 334 B
dynamic-HASH.js gzip 1.81 kB 1.8 kB
edge-ssr-HASH.js gzip 255 B 255 B
head-HASH.js gzip 353 B 349 B 🟢 4 B (-1%)
hooks-HASH.js gzip 384 B 382 B
image-HASH.js gzip 581 B 581 B
index-HASH.js gzip 260 B 259 B
link-HASH.js gzip 2.51 kB 2.51 kB
routerDirect..HASH.js gzip 316 B 318 B
script-HASH.js gzip 386 B 386 B
withRouter-HASH.js gzip 313 B 314 B
1afbb74e6ecf..834.css gzip 106 B 106 B
Total 7.98 kB 7.97 kB ✅ -10 B

Server

Edge SSR
Canary PR Change
edge-ssr.js gzip 126 kB 126 kB
page.js gzip 273 kB 273 kB
Total 399 kB 398 kB ✅ -424 B
Middleware
Canary PR Change
middleware-b..fest.js gzip 616 B 619 B
middleware-r..fest.js gzip 156 B 156 B
middleware.js gzip 44.4 kB 44.4 kB
edge-runtime..pack.js gzip 842 B 842 B
Total 46 kB 46 kB ✅ -7 B
Build Details
Build Manifests
Canary PR Change
_buildManifest.js gzip 721 B 720 B
Total 721 B 720 B ✅ -1 B
Build Cache
Canary PR Change
0.pack gzip 4.38 MB 4.38 MB 🟢 5.12 kB (0%)
index.pack gzip 115 kB 113 kB 🟢 1.37 kB (-1%)
index.pack.old gzip 114 kB 115 kB
Total 4.61 MB 4.61 MB ✅ -5.46 kB

🔄 Shared (bundler-independent)

Runtimes
Canary PR Change
app-page-exp...dev.js gzip 346 kB 346 kB
app-page-exp..prod.js gzip 192 kB 192 kB
app-page-tur...dev.js gzip 346 kB 346 kB
app-page-tur..prod.js gzip 192 kB 192 kB
app-page-tur...dev.js gzip 343 kB 343 kB
app-page-tur..prod.js gzip 190 kB 190 kB
app-page.run...dev.js gzip 343 kB 343 kB
app-page.run..prod.js gzip 190 kB 190 kB
app-route-ex...dev.js gzip 77 kB 77 kB
app-route-ex..prod.js gzip 52.5 kB 52.5 kB
app-route-tu...dev.js gzip 77.1 kB 77.1 kB
app-route-tu..prod.js gzip 52.6 kB 52.6 kB
app-route-tu...dev.js gzip 76.7 kB 76.7 kB
app-route-tu..prod.js gzip 52.3 kB 52.3 kB
app-route.ru...dev.js gzip 76.6 kB 76.6 kB
app-route.ru..prod.js gzip 52.3 kB 52.3 kB
dist_client_...dev.js gzip 324 B 324 B
dist_client_...dev.js gzip 326 B 326 B
dist_client_...dev.js gzip 318 B 318 B
dist_client_...dev.js gzip 317 B 317 B
pages-api-tu...dev.js gzip 43.9 kB 43.9 kB
pages-api-tu..prod.js gzip 33.5 kB 33.5 kB
pages-api.ru...dev.js gzip 43.9 kB 43.9 kB
pages-api.ru..prod.js gzip 33.5 kB 33.5 kB
pages-turbo....dev.js gzip 53.3 kB 53.3 kB
pages-turbo...prod.js gzip 39.1 kB 39.1 kB
pages.runtim...dev.js gzip 53.3 kB 53.3 kB
pages.runtim..prod.js gzip 39.1 kB 39.1 kB
server.runti..prod.js gzip 62.9 kB 62.9 kB
Total 3.06 MB 3.06 MB ✅ -90 B
📝 Changed Files (8 files)

Files with changes:

  • app-page-exp..ntime.dev.js
  • app-page-exp..time.prod.js
  • app-page-tur..ntime.dev.js
  • app-page-tur..time.prod.js
  • app-page-tur..ntime.dev.js
  • app-page-tur..time.prod.js
  • app-page.runtime.dev.js
  • app-page.runtime.prod.js
View diffs
app-page-exp..ntime.dev.js
failed to diff
app-page-exp..time.prod.js

Diff too large to display

app-page-tur..ntime.dev.js
failed to diff
app-page-tur..time.prod.js

Diff too large to display

app-page-tur..ntime.dev.js

Diff too large to display

app-page-tur..time.prod.js

Diff too large to display

app-page.runtime.dev.js

Diff too large to display

app-page.runtime.prod.js

Diff too large to display

📎 Tarball URL
https://vercel-packages.vercel.app/next/commits/89f04275007d1d76eb502f7163bf8051e94dc5e9/next

@mmastrac mmastrac closed this Apr 15, 2026
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants