CloudFlare R2: Unauthorized yet it works in Minio

Hi there!

I’m trying to setup R2 storage via aws-sdk package. Somehow nothing worked with @aws-sdk/client-s3 package so we downgraded it. We tested how our code works by working with Minio, but when we change credentials to Cloudflare R2 it shows 401 (Unauthorized) error. Yet, when I use wrangler to test if uploading works with it, then wrangler uploads successfully.

What are we doing wrong? We are generating keys for Admin Read & Write, but it still shows Unauthorized error. We also tested default and EU endpoints.

1 Like

Did you find a solution to this? Everything was working but suddenly I get 401 unauthorized, error when I try to upload files to r2 through pre-signed urls.