`wrangler r2 bulk put`: retry transient failures, and report what was uploaded when the command fails
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 62/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
- 領域
- cli
調査の方向性
Start in packages/wrangler/src/r2/object.ts at the r2 bulk put handler: read how the PQueue is built and how queue.addAll(...) is awaited, then read putRemoteObject in packages/wrangler/src/r2/helpers/object.ts for the single fetch. Look at the existing r2 tests under packages/wrangler/src/__tests__/r2 to see how uploads are mocked, and run them before changing anything. Done means each upload retries with backoff on network/429/5xx, the queue stops starting new work on a final failure while draining in-flight tasks, progress prints after completion, and the exit summary lists uploaded, failed and not-attempted keys.
索引モデルが issue の本文から書いたものです。
説明
Summary
wrangler r2 bulk put stops at the first failed upload. It does not retry that upload, it does not wait for the uploads that are still running, and the error names only the one file that failed. After a failure, the user cannot tell which objects are in the bucket without listing it.
This is a request for two changes:
- Retry a failed upload a few times before giving up, at least for network errors, 429 and 5xx responses.
- When an upload fails for good, let the in-flight uploads finish, then print how many objects were uploaded and which ones failed or were never started.
What happens today
The code is in packages/wrangler/src/r2/object.ts (the r2 bulk put handler) and packages/wrangler/src/r2/helpers/object.ts (putRemoteObject).
- Each upload is one
fetchwith no retry. - Each upload is a
PQueuetask that rethrows its error as aFatalError. The handler awaitsqueue.addAll(...), which rejects as soon as one task rejects. The process then exits while the other tasks are still running. - The progress line (
Uploaded 33% (20 out of 60)) is printed when an upload starts, not when it finishes, so it overstates what was stored.
Reproduction
Tested with wrangler 4.77.0 on macOS, Node 24.14. The code paths above are unchanged on main as of Nov. 23, 2026.
- Create an empty bucket.
- Write a list of 60 entries, each a 256 KiB file. Make one entry in the first 20 fail: I gave entry 5 a key of 1,100 characters, which the API rejects with 400.
- Run
wrangler r2 bulk put <bucket> --filename list.json --remote(default concurrency of 20). - List the bucket.
Result over three runs:
| Run | Exit code | Time to exit | In-flight uploads stored (of 19) | Entries never started (of 40) |
|---|---|---|---|---|
| 1 | 1 | 0.6 s | 12 | 40 |
| 2 | 1 | 0.7 s | 17 | 40 |
| 3 | 1 | 0.7 s | 19 | 40 |
The output in every run was the same: Uploaded 33% (20 out of 60), then an error naming entry 5 only. The same list without the failing entry uploads 60 of 60 and exits 0.
So one rejected object out of 60 left the bucket with 12, 17 or 19 objects, and nothing in the output says which.
Why it matters
- Whether an abandoned upload is stored depends on how far its request had got when the process exited. The result differs from run to run.
- A single transient error fails the whole run. Bulk uploads of thousands of objects hit one sooner or later. See #12687 and #12413, where a
fetch failedor a 503 partway through ended the command. - Re-running the command is the only recovery, and it uploads everything again.
Suggested behavior
- Retry each upload up to a small fixed number of times with backoff, for network errors, 429 and 5xx.
- On a final failure, stop starting new uploads, wait for the in-flight ones, and exit non-zero with a summary: objects uploaded, objects failed (with the error for each), objects not attempted.
- Print progress when an upload finishes.
- 主要言語
- TypeScript
- スター
- 4.7k
- フォーク
- 1.7k
- 平均マージ
- 1日 22時間
- マージ済み PR(30日)
- 282
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cloudflare/workers-sdk のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
cloudflare/workers-sdk#17215 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
cloudflare/workers-sdk#17189 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
cloudflare/workers-sdk#17187 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
cloudflare/workers-sdk#17175 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
cloudflare/workers-sdk#17174 ·
メンテナーはふだん 1 日以内に返信
cloudflare/workers-sdk の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
earendil-works/pi#12615 ·
メンテナーはふだん 1 日以内に返信
-
My Caps shows "Shared" on private Caps that were never shared対応中かも @AksharP5 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
CapSoftware/Cap#4569 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
OHDSI/Data2Evidence#3749 ·
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Flagsmith/flagsmith-nodejs-client#332 ·
メンテナーはふだん 2 日以内に返信