我在使用mws-sdk-promises库(https://www.npmjs.com/package/mws-sdk-promises)时遇到了一些麻烦。
我收到此错误。我已经仔细检查了所有插件的信息是否正确。我不知道为什么我会得到这个块。我该如何解决这个问题?
--------
{"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;
答案 0 :(得分:0)
您确定您的ENV变量正确吗?似乎是身份验证错误。
再次检查以下环境变量:
AWS_ACCESS_KEY_ID
SECRET_ACCESS_KEY
MERCHANT_SELLER_ID
您的时间和时区必须正确。你也检查过吗?