#7686 TypeError: This ReadableStream did not return bytes when using trpc with SSE
Valid workerd bug with reproduction. Multiple users confirmed over 1 year. Related to #7767. Workaround exists: use TransformStream instead of ReadableStream with controller.
Keep open as workerd runtime issue; link to #7767; document TransformStream workaround
Analysis Report
Issue Review: cloudflare/workers-sdk#7686
Summary
tRPC SSE subscriptions fail with "TypeError: This ReadableStream did not return bytes" in workerd/Cloudflare Workers.
Findings
- Created: 2025-01-07
- Updated: 2025-10-30
- Version: wrangler 3.99.0, Node 22.12.0 -> wrangler 4.60.0
- Component: Workers Runtime (workerd)
- Labels: bug
- Comments: 3 (multiple users confirming issue)
Key Evidence
- Reproduction repo provided: https://github.com/dandoen/cloudflare-trpc-subscription
- Works with standalone HTTP server but fails in Cloudflare Workers
- Error: "TypeError: This ReadableStream did not return bytes"
- Multiple users confirming same issue (Jan 2025, Feb 2025, Oct 2025)
- One user found workaround: use TransformStream instead of ReadableStream with controller
- Related to issue #7767 (both SSE-related)
- This is a workerd runtime limitation with how ReadableStream is handled for SSE/streaming
- No PRs found fixing this
Recommendation
Status: KEEP OPEN
Reasoning: This is a valid workerd runtime bug affecting tRPC SSE subscriptions and similar streaming patterns. Multiple users have confirmed the issue over the past year. A workaround exists (using TransformStream instead of ReadableStream with controller). The issue has 2 emoji reactions and ongoing community engagement.
Action: Keep open as a workerd runtime issue. Link to related #7767 as both involve SSE/streaming issues. Document the TransformStream workaround prominently.
Suggested Comment
This appears to be related to #7767 - both involve SSE/streaming failing in workerd.
Workaround: As @hyusetiawan discovered, using TransformStream instead of creating a ReadableStream with a controller works:
const { readable, writable } = new TransformStream(); const writer = writable.getWriter(); // Write to writer instead of using ReadableStream controller return new Response(readable, { headers: { 'Content-Type': 'text/event-stream' } });This is a workerd runtime limitation. Keeping this open for the runtime team to investigate.
@davyzhang - are you still experiencing this with the latest wrangler version (4.60.0)?
Notes & Feedback (0)
No notes yet.