dimanche 3 mai 2015

UnknownError from using AWSJavaScriptSDK glacier

I am pulling my hair for 2 hours trying to find what's going on. I've got UnknownError from making use of AWSJavaScriptSDK to upload file to AWS Glacier.

var AWS, buffer, config, glacier, params, vaultName;

AWS = require('aws-sdk');

AWS.config.update({
  accessKeyId: "KEY_ID",
  secretAccessKey: "SECRETE",
  region: "ap-southeast-2"
});

glacier = new AWS.Glacier();

vaultName = "arn:aws:glacier:ap-southeast-2:VAULT_ID:vaults/VAULT_NAME";

buffer = new Buffer(2.5 * 1024 * 1024);

params = {
  vaultName: vaultName,
  body: buffer
};

glacier.uploadArchive(params, function(err, data) {
  if (err) {
    return console.log("Error uploading archive!", err);
  }
});

The result in the console is bellow:

Error uploading archive! { [UnknownError: 400]
  message: '400',
  code: 'UnknownError',
  statusCode: 400,
  time: Mon May 04 2015 00:03:20 GMT+1000 (AEST),
  retryable: false,
  retryDelay: 30 }

I've tried:

  • Using root api keys and secrete ( try to rule out permission issue )
  • not setting the api keys or set a wrong ones
  • Upload file from fs.readFile instead of using Buffer
  • include accountId: "-" to the param variable

All attempts result in the same error.




Aucun commentaire:

Enregistrer un commentaire