thomasg
03/12/2023, 1:31 AMthomasg
03/12/2023, 1:33 AMthomasg
03/12/2023, 1:34 AMthomasg
03/12/2023, 2:06 AMian
03/12/2023, 2:26 AMaws s3 cp --endpoint-url=... localfile.txt s3://bucket/
. It gets a few gigabytes into the upload but then fails with An error occurred (InternalError) when calling the UploadPart operation (reached max retries: 4): We encountered an internal error. Please try again.
. This happens every time I run the upload. Any ideas for how to resolve?skyadmin
03/12/2023, 4:51 AMSid | R2
03/12/2023, 10:53 AMminester16
03/12/2023, 11:54 AMnpx wrangler r2 object put r2-test/100MB.bin --file=100MB.bin
After I got this response:
Creating object "100MB.bin" in bucket "r2-test".
Upload complete.
Then I tried to download file:
npx wrangler r2 object get "r2-test/100MB.bin"
I got this error:
Downloading "100MB.bin" from "r2-test".
X [ERROR] Failed to fetch /accounts/$JOEDOE/r2/buckets/r2-test/objects/100MB.bin - 404: Not Found);
I can see file in Cloudflare dashboard btw and able to download.
What's wrong? What I am doing wrong? Am I need to set permissions even for reaching from wrangler?mattw
03/12/2023, 9:42 PMcompleteMultipartUpload: Your proposed upload is smaller than the minimum allowed object size.
. What is the minimum size of a multipart upload? Is this in the documentation? (I cannot seem to find anything)TetraEtc
03/12/2023, 9:59 PMSid | R2
03/12/2023, 10:12 PMSid | R2
03/12/2023, 10:14 PMmattw
03/12/2023, 10:16 PMmattw
03/12/2023, 10:16 PMSid | R2
03/12/2023, 10:17 PMJoselito
03/13/2023, 12:41 AMTetraEtc
03/13/2023, 1:30 AMmattw
03/13/2023, 3:07 AMstrxkeskit
03/13/2023, 7:48 AMHardAtWork
03/13/2023, 7:53 AMAngelo Bestetti
03/14/2023, 11:21 AMSid | R2
03/14/2023, 12:07 PMEli
03/14/2023, 8:18 PMconst r2 = new AwsClient({
accessKeyId: config.r2.accessKey,
secretAccessKey: config.r2.secretKey
})
const url =
`https://${config.r2.bucketName}.${config.r2.accountId}.r2.cloudflarestorage.com` +
'/profile/image-name.png' +
'?' + 'X-Amz-Expires=3600' // expires in 1 hour
const signed = await r2.sign(
new Request(url, {
method: 'PUT',
headers: {
'Content-Type': fileType
}
}),
{
aws: { signQuery: true }
}
)
return signed.url
kian
03/14/2023, 8:37 PMEli
03/14/2023, 8:39 PMalbert
03/14/2023, 8:45 PMContent-Length: <size>
in the signed request.Eli
03/14/2023, 8:56 PMconst url =
`https://${config.r2.bucketName}.${config.r2.accountId}.r2.cloudflarestorage.com` +
'/profile/' +
`${nanoid(6)}.${fileType.split('/')[1]}`
'?' + `X-Amz-Expires=3600&Content-Length=${fileSize}&Content-Type=${fileType}`
const signed = await r2.sign(
new Request(url, {
method: 'PUT',
headers: {
'Content-Type': fileType,
'Content-Length': `${fileSize}}`
}
}),
{
aws: { signQuery: true }
}
)
After creating the URL i'm able to upload anything I want of any size using this and get a 200 OK
curl -X PUT \
'https://someurl.r2.cloudflarestorage.com/profile/GBEoCP.png?X-Amz-Date=20230314T205007Z&X-Amz-Expires=86400&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=837367ca5b70597148acc8e7808fb6af%2F20230314%2Fauto%2Fs3%2Faws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=4c290f05240b76e1d1a9134eecc8464f55747660b9ff18a93c353469a51670ae' \
--header 'Content-Type: image/png' \
--data-binary '@/Users/eli/Downloads/16.4.zip'
Brame
03/15/2023, 2:36 AMAngelo Bestetti
03/15/2023, 2:40 AMBrame
03/15/2023, 2:41 AM