Skip to content

[codex] Fix wrangler dev suspense streaming#879

Draft
southpolesteve wants to merge 1 commit intomainfrom
codex/fix-wrangler-suspense-streaming
Draft

[codex] Fix wrangler dev suspense streaming#879
southpolesteve wants to merge 1 commit intomainfrom
codex/fix-wrangler-suspense-streaming

Conversation

@southpolesteve
Copy link
Copy Markdown
Collaborator

Summary

  • Add a local Wrangler dev response wrapper that sets Content-Encoding: identity for streamed loopback App Router responses without explicit body headers.
  • Replace whole-line RSC Flight hint buffering with a streaming transform so partial non-hint rows can flow immediately.
  • Keep the SSR HTML/RSC embed flush independent of host timers while preserving tick-level batching.

Root Cause

wrangler dev/Miniflare buffers streamed non-SSE responses unless compression is explicitly avoided. The behavior reproduces with a plain ReadableStream route, outside React and vinext rendering. Setting Content-Encoding: identity restores chunk delivery locally.

This aligns with upstream Cloudflare workers-sdk issue #8004, which describes Miniflare aggressively buffering responses and lists Content-Encoding: identity as the workaround.

Validation

  • npx vp test run tests/app-ssr-stream.test.ts tests/rsc-streaming.test.ts tests/deploy.test.ts -t "applyLocalDevStreamingHeaders|host timers|createFlightHintFixTransform"
  • npx vp check packages/vinext/src/server/worker-utils.ts packages/vinext/src/server/app-router-entry.ts packages/vinext/src/server/app-ssr-stream.ts packages/vinext/src/server/flight-hints.ts packages/vinext/src/entries/app-rsc-entry.ts tests/app-ssr-stream.test.ts tests/rsc-streaming.test.ts tests/deploy.test.ts
  • npx vp run vinext#build
  • Manual Wrangler repro: before the workaround /streaming buffered until ~830ms; after the workaround the fallback arrived at ~47ms and resolved content at ~834ms.

Copy link
Copy Markdown
Collaborator Author

This might be a sufficient workaround for the reported wrangler dev streaming problem, but I do not think we should treat it as the final answer yet.

The buffering reproduces with a plain ReadableStream response outside React/vinext, and it lines up with the upstream Miniflare buffering issue tracked in cloudflare/workers-sdk#8004. If this is fixed upstream, we should prefer that path and avoid keeping a vinext-specific workaround unless we decide the local-dev compatibility value is worth the extra response-header behavior.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 24, 2026

Open in StackBlitz

npm i https://pkg.pr.new/vinext@879

commit: b08ce9a

@github-actions
Copy link
Copy Markdown

Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original

@LubomirGeorgiev
Copy link
Copy Markdown

Ref #874

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants