cloudflare / cloudflare/cloudflare-docs
It is unclear which s3 clients can be used in workers to interact with R2
- Dominant language
- MDX
- Stars
- 5.2k
- Forks
- 16.7k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 337
Description
### Existing documentation URL(s)
https://developers.cloudflare.com/r2/api/s3/presigned-urls/#generate-presigned-urls
https://developers.cloudflare.com/r2/examples/aws/aws-sdk-js-v3/#generate-presigned-urls
https://developers.cloudflare.com/r2/examples/aws/aws-sdk-js/#generate-presigned-urls
### What changes are you suggesting?
The [docs for generating pre-signed urls for R2 buckets](https://developers.cloudflare.com/r2/api/s3/presigned-urls/#generate-presigned-urls) list several clients that can be used, including:
- `aws-sdk` is now EOS. https://www.npmjs.com/package/aws-sdk and AWS recommends using SDKv3.
- SDKv3 appears to not be usable inside a worker due to unimplemented nodejs apis.
aws-sdk is usable inside a worker if you set the right compatibility_flags and compatibility_date in your wrangler config.
From an R2 perspective the docs do a good job of listing clients that technically work, but they should be more explicit in calling out that from a workers context _both_ SDKv3 and aws-sdk are dead ends.
`aws4fetch` appears to be viable (I haven't yet tried it) - but it's api isn't as friendly to use as SDKv3
### Additional information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.