workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

🐛 BUG: R2 bucket creation is broken due to API change

Open Erisa opened this issue 3 years ago • 0 comments
trafficstars

What version of Wrangler are you using?

2.0.25

What operating system are you using?

Ubuntu WSL

Describe the Bug

The command wrangler r2 bucket create bucketname now fails due to a change in the R2 API.

Currently wrangler uses PUT /accounts/<id>/r2/buckets/<bucketname>, which no longer works.

https://github.com/cloudflare/wrangler2/blob/7ae059b3dcdd9dce5f03110d8ff670022b8ccf02/packages/wrangler/src/r2.ts#L32-L40

The API now (according to tracing the dashboard) seems to use POST /accounts/<id>/r2/buckets with a JSON body of {"name":"bucketname"} I'm not 100% sure whether this same method works in wrangler, or if another endpoint should be used.

Error:

Creating bucket bucketname.

✘ [ERROR] A request to the Cloudflare API (/accounts/ece1d09b06af2ced51407c97505ea0cc/r2/buckets/bucketname) failed.

  No route matches this url. [code: 10015]

  If you think this is a bug, please open an issue at:
  https://github.com/cloudflare/wrangler2/issues/new/choose

Erisa avatar Aug 10 '22 21:08 Erisa