odysseyscience / react-s3-uploader

React component that renders an <input type="file"/> and automatically uploads to an S3 bucket
MIT License
827 stars 240 forks source link

Getting CORS error on uploading file on AWS S3 #235

Open abhimanusharma opened 3 years ago

abhimanusharma commented 3 years ago

Here is my jsx code:

<ReactS3Uploader
    getSignedUrl={props.getSignedUrl}
    accept="image/*"
    onProgress={onProgress}
    onError={onError}
    onFinish={onFinish}
    uploadRequestHeaders={{
        'x-amz-acl': 'public-read'
    }}
    contentDisposition="auto"
/>

Here is my method:

getSignedUrl = async (file, callback) => {
    const { dispatch } = this.props;
    const params = {
      objectName: file.name,
      contentType: file.type
    };
    const response = await dispatch(getSignedUrl(params));
    console.log(response);
    callback(response);

  }

The above dispatch method is getting signed url from my NestJs server.

Here is my error: Screenshot from 2021-07-02 12-55-17

mclean25 commented 3 years ago

@abhimanusharma were you able to solve this?

waleedarshad commented 2 years ago

@abhimanusharma @mclean25 any updates?

rolandin commented 1 year ago

Also getting a cors issue when uploading, it would be good to know if there is something wrong or it's just something in the server settings