-
Notifications
You must be signed in to change notification settings - Fork 629
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
Update R2 Error Handling for Invalid Characters #5032
Conversation
🦋 Changeset detectedLatest commit: 3981253 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9889399659/npm-package-wrangler-5032 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5032/npm-package-wrangler-5032 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9889399659/npm-package-wrangler-5032 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9889399659/npm-package-create-cloudflare-5032 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9889399659/npm-package-cloudflare-kv-asset-handler-5032 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9889399659/npm-package-miniflare-5032 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9889399659/npm-package-cloudflare-pages-shared-5032 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9889399659/npm-package-cloudflare-vitest-pool-workers-5032 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
.changeset/brown-ties-deliver.md
Outdated
@@ -0,0 1,5 @@ | |||
--- | |||
"wrangler": major |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a patch/minor bump, not a major
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for flagging, changed to patch.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5032 /- ##
==========================================
- Coverage 70.64% 70.36% -0.29%
==========================================
Files 292 298 6
Lines 15178 15518 340
Branches 3860 3985 125
==========================================
Hits 10723 10919 196
- Misses 4455 4599 144
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! The only thing remaining is an update to the docs—it looks like you checked off the checkbox for this including docs, but didn't link the issue/PR. Would you be able to do that, and then we can get this merged and released?
packages/wrangler/src/r2/helpers.ts
Outdated
name: string | undefined | ||
): name is string { | ||
return ( | ||
typeof name === "string" && /^[a-zA-Z][a-zA-Z0-9-]*$/.test(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typeof name === "string" && /^[a-zA-Z][a-zA-Z0-9-]*$/.test(name) | |
typeof name === "string" && /^[a-zA-Z][a-zA-Z0-9-] $/.test(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can a bucket not have a single character for its name?
08c4258
to
07d7569
Compare
.changeset/brown-ties-deliver.md
Outdated
@@ -0,0 1,5 @@ | |||
--- | |||
"wrangler": major |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"wrangler": major | |
"wrangler": patch |
Since this would fail anyway, with a worse message, I don't think this is a breaking change requiring a major bump.
packages/wrangler/src/r2/helpers.ts
Outdated
name: string | undefined | ||
): name is string { | ||
return ( | ||
typeof name === "string" && /^[a-zA-Z][a-zA-Z0-9-]*$/.test(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can a bucket not have a single character for its name?
07d7569
to
4c5b06d
Compare
I ran the E2E tests locally. |
* Adding skeleton for error handling in R2 * Add test and update error handling * fix function errors * Add changeset * Updating changeset * Edit changeset file * Remove unecessary blankspace * fix up tests --------- Co-authored-by: Peter Bacon Darwin <[email protected]>
Fixes # [insert GH or internal issue number(s)].
What this PR solves / how to test:
Adds client side error handling for creating an R2 bucket with invalid characters
Author has addressed the following:
Note for PR author:
We want to celebrate and highlight awesome PR review! If you think this PR received a particularly high-caliber review, please assign it the label
highlight pr review
so future reviewers can take inspiration and learn from it.