AWS S3 x-amz-meta error with non-string values: InvalidHeader and InvalidParameterType

When trying to use node.js AWS sdk s3Client.uploadwith optional metadata parameters:

const AWS = require('aws-sdk')
const s3Client = new AWS.S3({
  params: {
    Key: key,
    secret: secret
  }
})

let uploadParams = {
  Bucket: '',
  Key: '',
  Body: '',
  ACL: 'public-read',
  Metadata: {
    dummy_value: null
  }

s3Client.upload(uploadParams, function(err, data) {
  console.log('Upload: ', data)
}

Error:

InvalidHeader: The x-amz-meta-dummy_value header contains an invalid value

0
source share
1 answer

Unfortunately, the AWS S3 SDK Documentation does not cover valid values ​​for the input attribute value of the x-amz-meta-added metadata.

dummy_value there should be a line

Errors are issued for:

  • undefined // InvalidHeader: x-amz-meta-dummy_value header contains an invalid value
  • null//InvalidHeader: x-amz-meta-dummy_value
  • 12//InvalidParameterType: params.Metadata ['dummy_value']
+1

All Articles