aws4fetch equivalent to getPresignedUrl & PutObjectCommand

i'm currently using @aws-sdk/client-s3 & @aws-sdk/s3-request-presigner. i like that my code is typesafe but i hate the 500kb added on top of my code for just these few lines of code... does anybody know the aws4fetch equivalent for this?
11 Replies
kian
kian16mo ago
Just AwsClient.sign and pass it a Request It’s in the R2 Presigned docs
sakuta
sakutaOP16mo ago
what's with ChecksumSHA256, Key, ContentLength, ContentType, ...? where do i pass these options
kian
kian16mo ago
Key is the URL path, the rest are headers
sakuta
sakutaOP16mo ago
same casing?
kian
kian16mo ago
Headers are case insensitive & ChecksumSHA256 is probably actually amz-checksum-something Look at the S3 PutObject docs for a list of all the valid headers
sakuta
sakutaOP16mo ago
the s3 docs are f*cking trash like honestly xd it's just sad that this beautiful code results in a 500kb increase of my bundle size -.- @kiannh why isn't the getPresignedUrl function included in the fetch context? all other r2 methods are included
kian
kian16mo ago
I’m not sure what you mean
sakuta
sakutaOP16mo ago
i mean the environment variables
kian
kian16mo ago
Presigning is a client-side thing apart of the S3 API, Workers bindings are their own API
sakuta
sakutaOP16mo ago
would still be benefitial as a lot of people use presigned urls
kian
kian16mo ago
You could recommend it in #r2 - the current go-to is just aws4fetch since it’s only 2.5KB and uses the same Web API objects people are used to.
Want results from more Discord servers?
Add your server