Skip to content

Getting CORS error on uploading file on AWS S3 #235

@abhimanusharma

Description

@abhimanusharma

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions