Skip to content

wrangler r2 bulk put Issue #12687

@Mohsan57

Description

@Mohsan57

What versions & operating system are you using?

wrangler 4.69.0, node 24.14.0, ubuntu 25.10

Please provide a link to a minimal reproduction

https://github.com/Mohsan57/agile-developers

Describe the Bug

When attempting to deploy a Next.js 15 application using @opennextjs/cloudflare, the deployment fails during the "Populating R2 incremental cache..." step. The underlying Cloudflare wrangler command (wrangler r2 bulk put) throws a TypeError: fetch failed while uploading chunks of cached items to the newly created R2 cache bucket.

The upload consistently starts and pushes several batches of objects (e.g., up to 81%) before hanging and crashing with the networking/fetch error.

Steps to reproduce

  1. Setup a Next.js (app router) project.
  2. Configure OpenNext for Cloudflare (@opennextjs/cloudflare@1.17.1).
  3. Set up the required KV, R2, and Queue bindings in wrangler.toml.
  4. Run the build step: npx opennextjs-cloudflare build.
  5. Run the deploy step: npx opennextjs-cloudflare deploy.
  6. See the error trigger during the remote bulk upload phase.

Expected behavior

The opennextjs-cloudflare deploy command should successfully populate the Cloudflare R2 bucket with the Next.js build cache and complete the worker deployment.

Actual behavior

The deployment crashes with:

┌──────────────────────────────┐
│ OpenNext — Cloudflare deploy │
└──────────────────────────────┘

Populating R2 incremental cache...
Starting bulk upload of 61 objects to bucket agile-dev-cache using a concurrency of 50
Uploaded 16% (10 out of 61)
Uploaded 32% (20 out of 61)
Uploaded 49% (30 out of 61)
Uploaded 65% (40 out of 61)
Uploaded 81% (50 out of 61)

▲ [WARNING] 🚧 `wrangler r2 bulk put` is an experimental command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose

✘ [ERROR] Error uploading "/media/mohsan/Data/agiledevelopers/agile-developers/.open-next/cache/..."

  TypeError: fetch failed

Logs & Stack Trace

--- 2026-02-26T17:12:44.921Z error
✘ [ERROR] Error uploading "/media/mohsan/Data/agiledevelopers/agile-developers/.open-next/cache/__fetch/uUMv_WooDPbr5_KG74cJB/7e61489bad21b2e6f74912312cfbf4769c1bf3030bbed4d1725692e98eacb3e2"

  TypeError: fetch failed

--- 2026-02-26T17:12:44.921Z debug
Error: Error uploading "/media/mohsan/Data/agiledevelopers/agile-developers/.open-next/cache/__fetch/uUMv_WooDPbr5_KG74cJB/7e61489bad21b2e6f74912312cfbf4769c1bf3030bbed4d1725692e98eacb3e2"
TypeError: fetch failed
    at /media/mohsan/Data/agiledevelopers/agile-developers/node_modules/wrangler/wrangler-dist/cli.js:271602:23
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
    at async /media/mohsan/Data/agiledevelopers/agile-developers/node_modules/wrangler/wrangler-dist/cli.js:128855:30

Environment

  • OS: Linux (Ubuntu)
  • Node.js version: v24.14.0
  • Package Manager: npm
  • Framework Version: Next.js v15.2.8
  • OpenNext Version: @opennextjs/cloudflare@1.17.1
  • Wrangler Version: 4.69.0

Additional context

The issue seems to be a combination of OpenNext's caching script pushing large bulk data and Cloudflare's experimental wrangler r2 bulk put. Setting NODE_OPTIONS="--dns-result-order=ipv4first" does not alleviate the fetch failure.

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

Labels

r2Relating to R2

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions