CORS :/

hi all - I had a function working yesterday to upload large files to a bucket. Come back today, and I'm getting CORS error. I've checked my CORS settings and my IP is included in the allowed, as well as the R2 API Token is a forever token. Any thoughts?
4 Replies
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
oldmanmeta
oldmanmeta14mo ago
Sorry Sid - I didn't see this sub message thing. Cool This is the CORS policy on the bucket: [ { "AllowedOrigins": [ "http://localhost:8081", "http://192.168.1.104:8081/", "http://192.168.1.100:8080/" ], "AllowedMethods": [ "GET", "PUT", "POST" ], "AllowedHeaders": [ "" ] } ] This is my S3Client call: const S3 = new S3Client({
region: "auto", endpoint: https://${CF_ACCOUNT_ID}.r2.cloudflarestorage.com, credentials: { accessKeyId: CF_ACCESS_KEY_ID, secretAccessKey: CF_ACCESS_KEY_SECRET, }, requestHandler: new XhrHttpHandler({}), // overrides default FetchHttpHandler in browsers. }); I'm using the Upload function in the S3 Lib for large files: const parallelUploads3 = new Upload({ client: S3, params: { Bucket: bucketName, Key: bucketKeyName, Body: largeFile }, tags: [ /
...*/ ], // optional tags queueSize: 4, // optional concurrency configuration partSize: (largeFile.size <= 5242880) ? 5242880 : largeFile.size * 2, // 1024 * 1024 * 10, // optional size of each part, in bytes, at least 5MB leavePartsOnError: false, // optional manually handle dropped parts });
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
oldmanmeta
oldmanmeta14mo ago
Great pickup on the trailing slashes! That was it. Thank you so much.