Help with R2 presigned URL

When I put the presigned URL into a browser, I get a 403 Fobidden error. I added CORS using this via postman successfully:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="">

And I created the presigned URL in a worker using this (the GUID is the name of my file):

app.get('/api/portal/', async c => {
    const request = new Request(`https://<MY_BUCKET>.<MY_ID>`, { 
        method: 'PUT'

    const presigned = await r2.sign(request, { aws: { signQuery: true } })

    return c.json(presigned.url);

And I got this URL back:


Any ideas on how to troubleshoot? Thanks

I forgot the error message:

<?xml version="1.0" encoding="UTF-8"?>
    <Message>The request signature we calculated does not match the signature you provided. Check your secret access key and signing method. </Message>

My accessKeyId and secretAccessKey match what’s defined in my r2 API which has edit access for 1 year.

I figure it out. The presigned URL documentation could be improved for newbies :slight_smile:

I had to change my worker code from method: ‘PUT’ to ‘GET’ and now everything works as expected.