cloudflare / cloudflare/containers
PATCH requests with streaming body fail with "internal error"
- Dominant language
- TypeScript
- Stars
- 270
- Forks
- 42
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 4
Description
### Environment
- `@cloudflare/containers`: v0.0.30 (latest)
- Wrangler: 4.49.1
- Node.js: (runtime version)
- Date: 2025-11-21
### Description
PATCH requests containing streaming request bodies fail with an "internal error" when
using `container.fetch()`. The error occurs in the Worker SDK layer before the request
reaches the container.
### Use Case
Running a Zot OCI registry container. When pushing images via `podman push`:
- **POST** `/v2//blobs/uploads/` (Content-Length: 0) → ✅ **202 success**
- **PATCH** `/v2//blobs/uploads/` with blob data → ❌ **500 Internal Server
Error**
### Error Message
Error: internal error; reference = e5634i0hnfo8psp6kpb2vaqv
at async Object.fetch (index.js:929:22)
**Cloudflare Reference ID**: `e5634i0hnfo8psp6kpb2vaqv`
### Worker Code
Following the official example pattern from the documentation:
```javascript
import { Container, getContainer } from "@cloudflare/containers";
export class ZotContainer extends Container {
defaultPort = 8080;
sleepAfter = "30m";
enableInternet = true;
envVars = {
AWS_ACCESS_KEY_ID: "...",
AWS_SECRET_ACCESS_KEY: "..."
};
}
export default {
async fetch(request, env) {
const container = getContainer(env.ZOT, "zot-registry-singleton");
const response = await container.fetch(request);
return response;
},
};
```
### Observations
1. Container logs show PATCH requests never reach the container
- Container receives and processes POST requests successfully (returns 202)
- Container never receives PATCH requests - they fail in the Worker layer
2. Error occurs at SDK level
- Stack trace points to index.js:929:22 in the bundled SDK code
- Worker outcome is "exception"
- Execution model: "stateless"
3. Appears specific to streaming bodies
- POST with empty body (Content-Length: 0): ✅ Works
- PATCH with streaming data (Content-Length: 3930425, ~4MB): ❌ Fails
- Tested with different image sizes (2MB - 4MB) - all fail
### Request Details
Failing PATCH request:
- Method: PATCH
- Content-Type: application/octet-stream
- Content-Length: 3930425 (3.9 MB)
- Path: /v2/r2-test/alpine/blobs/uploads/
### Related Issues
This appears similar to #98, which was marked as resolved in October 2025. However, the
issue persists for PATCH requests with streaming bodies. Possible explanations:
- Different code path for PATCH vs POST
- Regression in recent SDK version
- Issue only affects certain request patterns (streaming body with Content-Length
header)
### Additional Context
- Container image: ghcr.io/project-zot/zot-linux-amd64:v2.1.0
- Durable Object singleton pattern with max_instances = 1
- enableInternet = true configured for R2 S3 API access
- Container starts successfully and processes GET/HEAD/POST requests correctly
### Logs
Worker logs (stateless):
```
{
"outcome": "exception",
"executionModel": "stateless",
"exception": {
"message": "internal error; reference = e5634i0hnfo8psp6kpb2vaqv",
"stack": " at async Object.fetch (index.js:929:22)"
}
}
```
Container logs show no PATCH requests received.
Contributor guide
Assessment
This issue has not been assessed yet.