I am having a problem uploading files to my r2 bucket from my running server in my PC.

I am having a problem uploading files to my r2 bucket from my running server in my PC. I can upload from my notebook, but not on my desktop. Error: Access to fetch at 'https://assets.1bcd53a1084b67fa3ddf1a0699695e41.r2.cloudflarestorage.com/listings/6fbc9c1c0163001bfa55/fb2f1779-dc0f-4a5e-b985-ad3deb6802a3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=31ebe7697dfe3b67c1dfc8f7deabc836%2F20240928%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20240928T221701Z&X-Amz-Expires=60&X-Amz-Signature=1fc3a9ba142244b76db925a3563f03a7ce26534621c0624dd56eafa025b4b453&X-Amz-SignedHeaders=host&x-id=PutObject' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. My R2 CORS: { "AllowedOrigins": [ "" ], "AllowedMethods": [ "GET", "PUT", "DELETE" ], "AllowedHeaders": [ "" ], "MaxAgeSeconds": 3000 } ]
3 Replies
Júlio
JúlioOP3mo ago
Júlio
JúlioOP3mo ago
Is is only happening on my local desktop Access to fetch at 'https://assets.1bcd53a1084b67fa3ddf1a0699695e41.r2.cloudflarestorage.com/listings/6fbc9c1c0163001bfa55/957ee9b8-425c-4e74-8457-ed68f8ea80da?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=d312b8c4f0a2d52142041e19f2a1eaa9%2F20240930%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20240930T134242Z&X-Amz-Expires=60&X-Amz-Signature=93b626f4310a2442788a476659b72e66df4b9a225909c53193c05c1c30f1d7f3&X-Amz-SignedHeaders=host&x-id=PutObject' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.Understand this error upload-file.ts:12

PUT https://assets.1bcd53a1084b67fa3ddf1a0699695e41.r2.cloudflarestorage.com/listings/6fbc9c1c0163001bfa55/957ee9b8-425c-4e74-8457-ed68f8ea80da?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=d312b8c4f0a2d52142041e19f2a1eaa9%2F20240930%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20240930T134242Z&X-Amz-Expires=60&X-Amz-Signature=93b626f4310a2442788a476659b72e66df4b9a225909c53193c05c1c30f1d7f3&X-Amz-SignedHeaders=host&x-id=PutObject net::ERR_FAILED 403 (Forbidden) uploadAsset @ upload-file.ts:12 await in uploadAsset (anonymous) @ ListingImagesEditor.tsx:39 addImage @ ListingImagesEditor.tsx:35 onFileChange @ ListingImagesEditor.tsx:66 (anonymous) @ use-event.js:10 Show 1 more frame Show lessUnderstand this error ListingImagesEditor.tsx:46 TypeError: Failed to fetch at uploadAsset (upload-file.ts:12:21) at async ListingImagesEditor.tsx:39:9 at async Promise.all (index 0) at async addImage (ListingImagesEditor.tsx:50:5) at async Object.onFileChange (ListingImagesEditor.tsx:66:11) Now I put 3600 of expire time and it workerd! Thanks a lot!
Want results from more Discord servers?
Add your server