2
votes

I am having some trouble with mws-sdk-promises library(https://www.npmjs.com/package/mws-sdk-promises).

I am getting this error. I've double checked all the plug in infos are correct. I haven no idea why I am getting this block. How can I fix this?

--------
{"ErrorResponse":{"$":{"xmlns":"https://mws.amazonservices.com/Orders/2013-09-01"},"Error":[{"Type":["Sender"],"Code":["SignatureDoesNotMatch"],"Message":["The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."]}],"RequestID":["e262570a-f493-4d3b-9183-88e528225599"]}}
-------- 

var express = require('express');
var router = express.Router();
var MWS = require('mws-sdk-promises'),
    client = new MWS.Client(process.env.AWS_ACCESS_KEY_ID, process.env.SECRET_ACCESS_KEY, process.env.MERCHANT_SELLER_ID, {}),
    MarketplaceId = process.env.MARKET_PLACE_ID;

router.get('/', function(req, res, next) {

  function getListOrders(client, args) {
    var req = MWS.Orders.requests.ListOrders();
    req.set('CreatedAfter', args.CreatedAfter);
    req.set('CreatedBefore', args.CreatedBefore);
    req.set('LastUpdatedAfter', args.LastUpdatedAfter);
    req.set('MarketplaceId', args.MarketplaceId);
    req.set('LastUpdatedBefore', args.LastUpdatedBefore);
    req.set('OrderStatus', args.OrderStatus);
    req.set('FulfillmentChannel', args.FulfillmentChannel);
    req.set('PaymentMethod', args.PaymentMethod);
    req.set('BuyerEmail', args.BuyerEmail);
    req.set('SellerOrderId', args.SellerOrderId);
    req.set('MaxResultsPerPage', args.MaxResultsPerPage);
    return client.invoke(req);
  }

    var date = new Date();
    getListOrders(client, {
    MarketplaceId: MarketplaceId,
    MaxResultsPerPage: 10,
    CreatedAfter: new Date(2016, 09, 1),
    CreatedBefore: new Date(2015, 1, 31)
  })
  .catch(function(error) {
    console.error("-----ERROR");
    console.error(error);
  })
  .then(function(RESULT){
    console.log("--------RESULT");
    console.log(JSON.stringify(RESULT));
    console.log("--------");
  });


});

module.exports = router;
1

1 Answers

0
votes

Are you sure that your ENV variables are correct? It seems like an authentication error.

Double check these env variables:

  • AWS_ACCESS_KEY_ID
  • SECRET_ACCESS_KEY
  • MERCHANT_SELLER_ID

Your time and timezone has to be correct. Did you check this too?