AWS无法使用Evaporate.js对'XMLHttpRequest'执行'setRequestHeader'

时间:2018-01-21 11:58:30

标签: javascript amazon-web-services amazon-s3 vue.js nuxt.js

我正在使用Evaporate(https://github.com/TTLabs/EvaporateJS)将我的文件上传到S3。该应用程序在Vue / Nuxt.js设置中,这是我的配置:

const uploadApiConfig = {
    signerUrl: '/api/sign_auth',
    awsRegion: process.env.awsRegion,
    aws_key: process.env.awsKey,
    bucket: process.env.awsBucket,
    computeContentMd5: true,
    awsSignatureVersion: '4',
    cryptoMd5Method: (data) => {
        return AWS.util.crypto.md5(data, 'base64')
    },
    cryptoHexEncodedHash256: (data) => {
        return AWS.util.crypto.sha256(data, 'hex')
    },
    signHeaders: {
        'authorization': `Bearer ${token}`
    }
}

但仍然出现此错误Failed to execute 'setRequestHeader' on 'XMLHttpRequest': 'AWS4-HMAC-SHA256 Credential=.../s3/aws4_request, SignedHeaders=host;x-amz-date任何人都可以提供帮助吗?

0 个答案:

没有答案