#6515 POST with body to Worker in local dev throws error
Request stream error when not draining body. ~30% failure rate. Filed by Cloudflare employee.
Investigate request body handling in local dev for DOs
Analysis Report
Issue Review: cloudflare/workers-sdk#6515
Summary
POST requests with body to a Worker/DO in local dev throw "Can't read from request stream after response has been sent" error.
Findings
- Created: 2024-08-16
- Updated: 2025-10-30
- Version: wrangler 3.72.0 → 4.61.0
- Component: wrangler
- Labels: bug
- Comments: 5
Key Evidence
- Reporter @threepointone (Cloudflare employee) found bug with POST requests to Durable Objects
- Error: "TypeError: Can't read from request stream after response has been sent"
- Related error in workerd: "kj/compat/http.c++:1989: failed: expected clean; can't read more data after a previous read didn't complete"
- Error appears with or without Content-Type header
- Workaround: Drain the body before sending response (e.g.,
await request.text()) - Local dev is "extremely fragile" - ~30% failure rate on simple benchmarks
- Repro repo provided: https://github.com/threepointone/durable-post-error
Recommendation
Status: KEEP OPEN
Reasoning: Valid bug affecting POST requests in local dev. Filed by Cloudflare employee with reproduction. The workaround (draining body) isn't always feasible. The ~30% failure rate and brittleness suggest deeper issues with request handling.
Action: Investigate request body handling in local dev, particularly for Durable Objects. Related to http stream management in workerd/miniflare.
Suggested Comment
N/A - Internal Cloudflare issue with clear reproduction; requires engineering investigation.
Notes & Feedback (0)
No notes yet.