【问题标题】:Error uploading on S3 through amplify storage reactjs通过放大存储reactjs在S3上上传错误
【发布时间】:2020-11-04 13:41:03
【问题描述】:

我正在使用最新版本的 aws/amplify 3.3.7

这是代码

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

当我尝试上传小文件(1 Mb zip 文件)时,它可以正常工作,但是当我尝试上传更大的文件(即 6 Mb zip 文件)时,我收到了错误:

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

有人遇到过这个问题

【问题讨论】:

    标签: reactjs aws-amplify


    【解决方案1】:

    我遇到了同样的问题,大约 5MB 后,Amplify 使用分段上传,但失败并出现同样的错误。

    我的解决方法是https://github.com/aws-amplify/amplify-js/issues/61

    我在 S3 存储桶的 CORS 设置中将 ETag 添加到 ExposeHeaders,之后上传 10 MB 的文件就可以正常工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-07
      • 2017-09-17
      • 1970-01-01
      • 2018-04-12
      • 2017-10-04
      • 2021-08-26
      • 2015-10-28
      • 1970-01-01
      相关资源
      最近更新 更多