Which Cloudflare product(s) does this pertain to?
R2, Wrangler
What versions are you using?
4.0.0
What operating system and version are you using?
Linux POP!_OS 22.04 LTS
Please provide a link to a minimal reproduction
No response
Describe the Bug
- Create a bucket using
wrangler r2 bucket create <your-bucket-name>
- Create a cors.json file with your policy.
- Set the CORS policy into the bucket with
wrangler r2 bucket cors set test-bucket --file cors.json
The policy file contains the following:
{
"rules": [
{
"AllowedOrigins": [
"http://example.com"
],
"AllowedMethods": ["GET", "HEAD", "PUT", "POST", "DELETE"],
"AllowedHeaders": [
"Authorization",
"Content-Type",
"Cache-Control",
"X-Requested-With"
],
"ExposeHeaders": [
"ETag",
"Content-Type",
"Content-Length",
"Content-Range"
],
"MaxAgeSeconds": 3600
}
]
}
I used the directive "rules" and not "CORSRules" by indication of wrangler that would throw an error about it otherwise.
The error also happened with the previous version of wrangler: 3.114.1
Please provide any relevant error logs
✘ [ERROR] A request to the Cloudflare API (/accounts/5dfb5fba4b0.../r2/buckets/test-bucket/cors) failed.
The JSON you provided was not well formed. [code: 10040]
Which Cloudflare product(s) does this pertain to?
R2, Wrangler
What versions are you using?
4.0.0
What operating system and version are you using?
Linux POP!_OS 22.04 LTS
Please provide a link to a minimal reproduction
No response
Describe the Bug
wrangler r2 bucket create <your-bucket-name>wrangler r2 bucket cors set test-bucket --file cors.jsonThe policy file contains the following:
{ "rules": [ { "AllowedOrigins": [ "http://example.com" ], "AllowedMethods": ["GET", "HEAD", "PUT", "POST", "DELETE"], "AllowedHeaders": [ "Authorization", "Content-Type", "Cache-Control", "X-Requested-With" ], "ExposeHeaders": [ "ETag", "Content-Type", "Content-Length", "Content-Range" ], "MaxAgeSeconds": 3600 } ] }I used the directive "rules" and not "CORSRules" by indication of wrangler that would throw an error about it otherwise.
The error also happened with the previous version of wrangler: 3.114.1
Please provide any relevant error logs