fortana-co / react-dropzone-uploader

React file dropzone and uploader
https://react-dropzone-uploader.js.org/
MIT License
445 stars 183 forks source link

Encountering S3 CORS Error with Presigned URL #26

Open BrickBeard opened 5 years ago

BrickBeard commented 5 years ago

The uploader has been working seamlessly for the past few weeks. This morning, without any changes, we started encountering a CORS error with every attempted upload:

Screen Shot 2019-08-14 at 10 16 42 AM

Our S3 bucket CORS configuration is as follows:

image

Any thoughts on why this may be occurring?

AntSan813 commented 5 years ago

Running into the same problem. Did you find a fix?

BrickBeard commented 5 years ago

@AntSan813 Yes! Thanks for prompting my response.

So, somehow after updating my API endpoint (using Python's Boto3 package), the s3.client() was no longer getting my default_region from the environment variables I had set. Basically, it was generating a presigned_url without accurate region information.

I went in and manually applied the region in my API:

region_ = 'us-east-2'
s3_client = boto3.client('s3', config=Config(region_name=region_))

...and it works like a charm! Now the presigned_url returned by my endpoint has the correct region included.