Nerxhan
Nerxhan

Reputation: 311

Error uploading on S3 through amplify storage reactjs

I'm using the latest version of aws/amplify 3.3.7

This is the code

const s3Upload = async (file, id) => { 
    const filename = file.name.replace(/\s/g, '') 
    await Storage.vault.put(filename, file, { 
      contentType: file.type 
   })
}

When I try to upload small files (1 Mb zip file) it works fine, but when I try to upload bigger files ie 6 Mb zip file, I'm getting the error:

AWSS3ProviderManagedUpload - error happened while finishing the upload. Cancelling the multipart upload Error: Request failed with status code 40

Anyone faced this problem

Upvotes: 3

Views: 2242

Answers (1)

Richard Wilbur
Richard Wilbur

Reputation: 66

I've been having the same issue where after around 5MB, Amplify uses multipart upload and it fails with the same error.

The fix for me was https://github.com/aws-amplify/amplify-js/issues/61

I added ETag to ExposeHeaders in the S3 bucket's CORS settings and it worked fine uploading a 10 MB file after that.

Upvotes: 5

Related Questions