Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DropzoneS3Uploader gives UploadError:404 after successful signed URL request #64

Open
karlheery opened this issue Sep 15, 2018 · 0 comments

Comments

@karlheery
Copy link

I'm building a serverless React app (using npm for development), that uses DropzoneS3Uploader to upload images to S3. I'm configuring it to use API Gateway (backed by Lambda) to request a signed URL before uploading a file to an S3 bucket

const uploadOptions = {
s3Path: '//',
signingUrl: 'https://.eu-west-1.amazonaws.com/Prod/',
signingUrlMethod: 'POST',
accept: 'image/*',
autoUpload: true
};

The render method goes on to return component as follows...

When this is executed it manages to generate the signed URL fine..

Request URL: https://.eu-west-1.amazonaws.com/Prod/?objectName=&contentType=image%2Fjpeg Request Method: POST Status Code: 200

{"signed_url":"https://.eu-west-1.amazonaws.com/<some_image.jpg>?X-Amz-Algorithm=AWS4-HMAC-....X-Amz-Signature=...&X-Amz-SignedHeaders=host"}

However it goes straight from that into a 404 (stacktrace below). I'm starting to wonder if npm tries to cache the image as a temp file? Whatever the problem it cant seem to reference the server/image during the PUT request to S3...

Request URL: http://localhost:3000/undefined Request Method: PUT Status Code: 404 Not Found

http://localhost:3000/undefined 404 (Not Found) ./node_modules/react-dropzone-s3-uploader/node_modules/react-s3-uploader/s3upload.js.S3Upload.uploadToS3 @ s3upload.js:171 (anonymous) @ s3upload.js:108 XMLHttpRequest.send (async) ./node_modules/react-dropzone-s3-uploader/node_modules/react-s3-uploader/s3upload.js.S3Upload.executeOnSignedUrl @ s3upload.js:113 ./node_modules/react-dropzone-s3-uploader/node_modules/react-s3-uploader/s3upload.js.S3Upload.uploadFile @ s3upload.js:178 (anonymous) @ s3upload.js:53 ...

There is a 'server' option as part of the DropzoneS3Uploader upload options. Leave it blank and i get this error, populate it with someone else and it replaces error with whatever server URL I mention. As mentioned, I plan to run this serverless so dont have a server to mention.

I switch to Dropzone and use axios and it works ok, so am wondering if DropzoneS3Uploader is just abstracting too much of the implementation code away to allow this behaviour to be controlled?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant