cloudflare / cloudflare/workers-sdk

[Miniflare] Consider buffering all requests

Open
#4,373 6 comments 5 reactions 0 assignees View on GitHub
package:miniflare
Dominant language
TypeScript
Stars
4.5k
Forks
1.5k
Avg merge
3d 8h
Merged PRs (30d)
187

Description

This code fails in miniflare but works when deployed in a worker:

```ts
env.R2_BUCKET.put(key, request.body); // request.body is the `Request` from the worker handler.
```

It fails with `Provided readable stream must have a known length (request/response body or readable half of FixedLengthStream)`. I've seen workarounds here with `FixedLengthStream` but since this is working in production I don't think it should fail in miniflare. Happy to give more information if needed.

wrangler version: 3.1.1

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Miniflare failure with the R2_BUCKET.put(key, request.body) example and trace Miniflare's request-body handling. Compare its known-length requirements with deployed Worker behavior; done means this request body is accepted locally without requiring a FixedLengthStream, with relevant coverage added if the existing test setup exposes this path.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.