odysseyscience / react-s3-uploader

React component that renders an <input type="file"/> and automatically uploads to an S3 bucket

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

s3 path and filename 'undefined' in production (works in development)

brambow opened this issue · comments

Thanks for this project. I'm trying to use it in a project where my React front end is completely separate from my node backend, and got everything working in local development.

However, for production I'm building static assets for my front end and serving them from a static web server (s3 actually...). When I run the upload operation in my production app, the signing service works as expected but the PUT url to the s3 bucket leaves the s3path and fileName undefined. Any ideas what could be going on?

Development:
image

Production:
image

I think this was an issue with my AWS configuration, nothing to do with this project.

@brambow What was the configuration change you made to make it work?

I'm using Cloudfront in front of S3 as a CDN, and if I remember correctly the issue was that I had to setup a cloudfront behavior for the path pattern "/s3/sign", allow HTTP Options, and enable query string forwarding.

It was the query string forwarding thing that was causing undefined, I'm pretty sure.