Cloudflare worker presigned url S3, R2
How do you generate presigned urls or S3 or R2... from cloudflare workers?
Solution:
Use
aws4fetch
package which is designed to work on cloudflare workers:
https://developers.cloudflare.com/r2/examples/aws/aws4fetch/
Do not use @aws-sdk/s3-request-presigner
as this depends on a @smithy
package that requires node:fs
, which is unsupported on Cloudflare. Calling a node:fs
will result in a is not a function
error
PS: I've already found a solution. Though I'd put this here for anybody facing the same issue.Cloudflare Docs
aws4fetch | Cloudflare R2 docs
You must generate an Access Key before getting started. All examples will utilize access_key_id and access_key_secret variables which represent the Access Key ID and Secret Access Key values you generated.
0 Replies