Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix R2 create bucket endpoint #1653

Merged
merged 4 commits into from
Aug 22, 2022
Merged

Fix R2 create bucket endpoint #1653

merged 4 commits into from
Aug 22, 2022

Conversation

WalshyDev
Copy link
Member

@WalshyDev WalshyDev commented Aug 10, 2022

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

@changeset-bot
Copy link

changeset-bot bot commented Aug 10, 2022

🦋 Changeset detected

Latest commit: b011b62

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

@github-actions
Copy link
Contributor

github-actions bot commented Aug 10, 2022

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

@KianNH
Copy link
Contributor

KianNH commented Aug 10, 2022

image

R2 is currently not happy with oauth_token :(

@KianNH
Copy link
Contributor

KianNH commented Aug 10, 2022

Closes #1654

@WalshyDev WalshyDev marked this pull request as draft August 10, 2022 22:38
Copy link

@vlovich vlovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @KianNH it wasn't clear. Did you say this still doesn't fix the issue?

@vlovich
Copy link

vlovich commented Aug 11, 2022

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

@KianNH
Copy link
Contributor

KianNH commented Aug 11, 2022

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]

@WalshyDev
Copy link
Member Author

WalshyDev commented Aug 12, 2022

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

@codecov
Copy link

codecov bot commented Aug 12, 2022

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%) ⬇️
packages/wrangler/src/pages/dev.tsx 21.54% <0.00%> (-1.21%) ⬇️
packages/wrangler/src/pages/errors.ts 25.00% <0.00%> (ø)
packages/wrangler/src/pages/build.tsx 61.81% <0.00%> (+0.94%) ⬆️
...ackages/wrangler/src/__tests__/helpers/mock-bin.ts 100.00% <0.00%> (+5.26%) ⬆️

@jacobbednarz
Copy link
Member

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

@WalshyDev WalshyDev marked this pull request as ready for review August 22, 2022 00:28
Copy link
Contributor

@threepointone threepointone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@WalshyDev WalshyDev merged commit 46b73b5 into main Aug 22, 2022
@WalshyDev WalshyDev deleted the walshy/fix-r2-endpoint branch August 22, 2022 11:44
@github-actions github-actions bot mentioned this pull request Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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