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

Fix R2 create bucket endpoint

Open WalshyDev opened this issue 3 years ago • 8 comments
trafficstars

The old PUT endpoint was removed in favour of POST { "name": "<bucket>" }

Once the fix for the POST endpoint is out, I'll mark this ready

WalshyDev avatar Aug 10 '22 21:08 WalshyDev

🦋 Changeset detected

Latest commit: b011b6270d108d7b1c36e682aaef6831f416c126

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Aug 10 '22 21:08 changeset-bot[bot]

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/2848331649/npm-package-wrangler-1653

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/1653/npm-package-wrangler-1653

Or you can use npx with this latest build directly:

npx https://prerelease-registry.developers.workers.dev/runs/2848331649/npm-package-wrangler-1653 dev path/to/script.js

github-actions[bot] avatar Aug 10 '22 21:08 github-actions[bot]

image

R2 is currently not happy with oauth_token :(

KianNH avatar Aug 10 '22 22:08 KianNH

Closes https://github.com/cloudflare/wrangler2/issues/1654

KianNH avatar Aug 10 '22 22:08 KianNH

Ah - we might have to make a change on our end too.

vlovich avatar Aug 11 '22 01:08 vlovich

Did you say this still doesn't fix the issue?

It'll fix the request that's sent to the API but it looks like the API rejects the authentication methods used by wrangler (oauth_token & api_token)

Using oauth_token via wrangler login:

POST method not allowed for the oauth_token authentication scheme [code: 10000]

Using api_token via CLOUDFLARE_API_TOKEN:

POST method not allowed for the api_token authentication scheme [code: 10000]

KianNH avatar Aug 11 '22 13:08 KianNH

The PUT endpoint has been reverted for now but the POST endpoint will still be the way to go so going to finish up this PR

Once the fix for the POST endpoint is out, I'll mark this ready

WalshyDev avatar Aug 12 '22 17:08 WalshyDev

Codecov Report

Merging #1653 (b011b62) into main (a366b12) will decrease coverage by 0.31%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1653      +/-   ##
==========================================
- Coverage   81.42%   81.10%   -0.32%     
==========================================
  Files          90       91       +1     
  Lines        5975     6012      +37     
  Branches     1532     1543      +11     
==========================================
+ Hits         4865     4876      +11     
- Misses       1110     1136      +26     
Impacted Files Coverage Δ
packages/wrangler/src/r2.ts 97.05% <100.00%> (ø)
packages/wrangler/src/pages/publish.tsx 45.27% <0.00%> (-1.21%) :arrow_down:
packages/wrangler/src/pages/dev.tsx 21.54% <0.00%> (-1.21%) :arrow_down:
packages/wrangler/src/pages/errors.ts 25.00% <0.00%> (ø)
packages/wrangler/src/pages/build.tsx 61.81% <0.00%> (+0.94%) :arrow_up:
...ackages/wrangler/src/__tests__/helpers/mock-bin.ts 100.00% <0.00%> (+5.26%) :arrow_up:

codecov[bot] avatar Aug 12 '22 17:08 codecov[bot]

@WalshyDev this should be ready to put back to review with the docs update landing in the next couple of days.

jacobbednarz avatar Aug 22 '22 00:08 jacobbednarz