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
kian2y ago
Just AwsClient.sign and pass it a Request It’s in the R2 Presigned docs
sakuta
sakutaOP2y ago
what's with ChecksumSHA256, Key, ContentLength, ContentType, ...? where do i pass these options
kian
kian2y ago
Key is the URL path, the rest are headers
sakuta
sakutaOP2y ago
same casing?
kian
kian2y 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
sakutaOP2y 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
kian2y ago
I’m not sure what you mean
sakuta
sakutaOP2y ago
i mean the environment variables
kian
kian2y ago
Presigning is a client-side thing apart of the S3 API, Workers bindings are their own API
sakuta
sakutaOP2y ago
would still be benefitial as a lot of people use presigned urls
kian
kian2y 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