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?![](https://cdn.answeroverflow.com/1130831859257983047/image.png)
11 Replies
Just AwsClient.sign and pass it a Request
It’s in the R2 Presigned docs
what's with ChecksumSHA256, Key, ContentLength, ContentType, ...?
where do i pass these options
Key is the URL path, the rest are headers
same casing?
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
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
I’m not sure what you mean
i mean the environment variables
Presigning is a client-side thing apart of the S3 API, Workers bindings are their own API
would still be benefitial
as a lot of people use presigned urls
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.