cloudflare / cloudflare/workers-sdk

Wrangler deploy repeatedly fails with write EPIPE on Workers Versions API after asset upload

Open
#15,230 3 comments 0 reactions 0 assignees View on GitHub
awaiting-response:reporter package:wrangler
Dominant language
TypeScript
Stars
4.5k
Forks
1.5k
Avg merge
3d 8h
Merged PRs (30d)
186

Description

### What versions & operating system are you using?

```text
System:
OS: macOS 26.2
CPU: (24) arm64 Apple M2 Ultra
Memory: 49.52 GB / 128.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 26.5.0
npm: 11.17.0
npmPackages:
@opennextjs/cloudflare: 1.20.1
@prisma/adapter-pg: 7.8.0
@prisma/client: 7.8.0
next: 16.2.10
prisma: 7.8.0
wrangler: 4.123.0
```

The same failure also occurred with Wrangler 4.110.0 before upgrading to 4.123.0.

### Please provide a link to a minimal reproduction

There is no public reproduction repository because this is a private production project. The failure reproduces consistently by running the project's OpenNext production deploy (`CLOUDFLARE_ENV=production opennextjs-cloudflare deploy`). A closely related prior report is #14922.

### Describe the Bug

Wrangler completes configuration processing, reads/uploads static assets, fetches the existing Worker settings successfully, and then consistently fails while creating the Worker version:

```text
POST /accounts//workers/scripts//versions
TypeError: fetch failed
[cause]: Error: write EPIPE
errno: -32
code: 'EPIPE'
syscall: 'write'
```

Wrangler retries the Versions API request three times. Each attempt fails after approximately 15 seconds without receiving an HTTP response.

Other Cloudflare API requests in the same deploy succeed. In the latest attempt:

- The asset upload returned HTTP 201.
- `GET /workers/scripts//settings` returned HTTP 200.
- Only `POST /workers/scripts//versions` failed.

The generated Worker is 15,749.04 KiB uncompressed / 3,880.29 KiB gzip. This account is on the Workers Paid plan. An almost identical bundle (15,748.80 KiB / 3,880.38 KiB gzip) deployed successfully from the same machine earlier on August 16, 2026, so this does not appear to be a bundle-size rejection.

The machine has normal connectivity and is not using a VPN, firewall, or explicit proxy. The behavior is consistent across repeated attempts and persisted after upgrading Wrangler.

This resembles #14922 and the Cloudflare incident documented at https://www.cloudflarestatus.com/incidents/z325n2dc14tk: other API calls and asset upload succeed, but the Versions API fails. That incident produced an HTML 403 WAF response, whereas this failure closes the connection with EPIPE before Wrangler receives any response. The project also uses Prisma with `@prisma/adapter-pg`, as did one of the reports in #14922.

Expected behavior: Wrangler should create and deploy the new Worker version, or return a structured API error explaining why the version was rejected.

### Please provide any relevant error logs

Sanitized excerpt from the latest Wrangler debug log:

```text
2026-08-16T21:01:41.553Z
POST https://api.cloudflare.com/client/v4/accounts//workers/assets/upload?base64=true

2026-08-16T21:01:42.286Z
HTTP 201 Created

2026-08-16T21:01:42.557Z
GET https://api.cloudflare.com/client/v4/accounts//workers/scripts//settings

2026-08-16T21:01:42.832Z
HTTP 200 OK

2026-08-16T21:01:42.839Z
POST https://api.cloudflare.com/client/v4/accounts//workers/scripts//versions

2026-08-16T21:01:58.008Z
TypeError: fetch failed
[cause]: Error: write EPIPE

2026-08-16T21:01:58.009Z
Retry: POST .../versions

2026-08-16T21:02:13.293Z
TypeError: fetch failed
[cause]: Error: write EPIPE

2026-08-16T21:02:14.295Z
Retry: POST .../versions

2026-08-16T21:02:29.683Z
TypeError: fetch failed
[cause]: Error: write EPIPE
```

Because the connection closes before an HTTP response is received, the log contains no status code or Cloudflare Ray ID for the failed requests.

Contributor guide

Open the contributing guide

Research direction

Start with the OpenNext production deploy entry point, `CLOUDFLARE_ENV=production opennextjs-cloudflare deploy`, and trace Wrangler's POST to the Workers Versions API after asset upload and settings retrieval. Compare the retry behavior for `/versions` with the successful requests; done means the Worker version deploys or Wrangler reports a structured API error instead of an unhandled EPIPE.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, node.js, typescript
Domain
api, cli, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.