Code Monkey home page Code Monkey logo

amazon-mws's Introduction

amazon-mws (Amazon Marketplace Web Service)

Version Build Status

This API supported Amazon Marketplace Web Service(MWS)'s standard REST-style API that accepts/returns JSON requests and Here is the API reference, Click Here

You can testify API through without any installation.

It does supports EcmaScript 8, TypeScript, async-await, Promises, Callback !
It does also supports for AWS Lambda like serverless cloud function call.
It supports pure JSON response.
All methods support Promise and Callback both.
Please Feel free to create Issue for any help !
All developers/contributors are requested to open Pull Request/Merge Request on development branch. Please make sure Test Cases be passed.

Installation

npm install amazon-mws --save

Pull Request

  • Contributors can send their Pull Request to development branch.
  • Kindly validate test cases & linting before opening new PR.

Do you need an expert?

Are you in need of a developer? If so, please reach out here. Submit your project request here. Originally by Bhushankummar - [email protected].

Examples

amazon-mws's People

Contributors

beastmike1 avatar bhushankummar avatar copperwall avatar danielecr avatar deo79 avatar dependabot[bot] avatar fmoro avatar jakeleventhal avatar jeffreypriebe avatar lnki-io avatar marcospampi avatar markspeich avatar piskunovim avatar ragubyun avatar raymatos avatar taehyunlim avatar tylerreece22 avatar wbaaron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amazon-mws's Issues

OrderStatus value seems to have no affect for amazonMws.orders.search()

Howdy Bhushankumar,

It appears setting the value of 'OrderStatus' to an array of valid values doesn't seem to have an effect to the results, is it be passed to the API correctly?

An example is...

amazonMws.orders.search({
        'Version': '2013-09-01',
        'Action': 'ListOrders',
        'SellerId': 'REMOVED',
        'MWSAuthToken': 'REMOVED',
        'MarketplaceId.Id.1': 'REMOVED',
        'OrderStatus': ["Unshipped", "Pending"],
        'MaxResultsPerPage' : 2, // def: 100, max 100
        'CreatedAfter' : new Date(1, 1, 2018),
        //'LastUpdatedAfter': new Date(13, 12, 2017),

    }, function (error, response) {
        if (error) {
            console.log('error ', error);
            return;
        }
        console.log('response', response);
    });
};

And the orders are returned, but it appears the OrderStatus was completely ignored as the orders that are returned are in multiple statuses, such as "Shipped".

Note: Multiple order statuses can be set, eg Pending and Unshipped as per the docs here http://docs.developer.amazonservices.com/en_IN/orders-2013-09-01/Orders_ListOrders.html

A list of OrderStatus values. Used to select orders with a current status that matches one of the status values that you specify.

Also using the value of :

'OrderStatus': "Unshipped",

Gives this response from Amazon:

error  { Type: 'Sender',
  Code: 'MalformedInput',
  Message: 'Unexpected list element termination',
  RequestId: '34ead115-4407-428b-a5b8-REMOVED' }

Matt

Node Version

Hi i can't run this on node v8.5.0. Can you kindly provide which version that you used?

Subscriptions in typescript definitions

Great library.
can you please add Subscriptions in type defs.

`

declare class AmazonMWS {

constructor()

constructor(key: string, token: string);

setApiKey(key: string, secret: string): void;

setHost(host?: string, port?: string, protocol?: string): void;

feeds: Feeds;

finances: Finances;

fulfillmentInboundShipment: FulfillmentInboundShipment;

fulfillmentInventory: FulfillmentInventory;

fulfillmentOutboundShipment: FulfillmentOutboundShipment;

merchantFulfillment: MerchantFulfillment;

orders: Orders;

products: Products;

reports: Reports;

sellers: Sellers;

}

`

No throttling information being returned

Every time I make a request, the Headers returned look like this:

{
  "x-mws-quota-max": "unknown",
  "x-mws-quota-remaining": "unknown",
  "x-mws-quota-resetson": "unknown",
  "x-mws-timestamp": "2018-07-12T20:29:43.558Z"
}

As you can see, it doesn't provide any throttling information.

Is there a way to fix this?

MWS 500 server error still crashes Node

Version 0.0.19. This is from a request to "GetMyFeesEstimate." The request was perfectly formed and this tends to happen randomly once in a few hundred operations. For this it is very hard to reproduce on demand.

Apparently MWS did not set a content-type header with the error response. (502 bad gateway)

<?xml version="1.0"?>
<ErrorResponse>
    <Error>
        <Type>Server</Type>
        <Code>500</Code>
        <Message>500 - Server Error</Message>
        <Detail />
    </Error>
</ErrorResponse>
/app/api/node_modules/amazon-mws/lib/AmazonMwsResource.js:211
2018-09-14T22:38:31.732701+00:00 app[worker.1]: if (headers['content-type'].indexOf('charset') > -1 && headers['content-type'].split(';')[0] && headers['content-type'].split(';')[1]) {
TypeError: Cannot read property 'indexOf' of undefined at ClientRequest.<anonymous> (/app/api/node_modules/amazon-mws/lib/AmazonMwsResource.js:211:41)

This wouldn't be a big deal, except for some reason it's bypassing my Promise catch handler and crashing the entire app.

No MWS Auth Token

Hi

I have my own account and not a developer account and hence i don't have MWS Auth token, so i leave this field blank but i am getting the following error which using this lib:
error { Type: 'Sender',
Code: 'AccessDenied',
Message: 'Access denied',
RequestId: 'afa979de-7684-4a53-b19d-9a9c5ecd97cd' }

Please suggest how to resolve?

thanks

GetFeedSubmissionResult fails

I got GetFeedSubmissionResult to fail, with the error log attached.
log.txt
That's the code I'm using
public async GetFeedSubmissionResult<T>(FeedSubmissionId: string, amcli = this.amcli): Promise<T> { try { const res: T = await amcli.feeds.search(this.BuildRequest({ FeedSubmissionId: FeedSubmissionId }, "GetFeedSubmissionResult")); return res; } catch (e) { throw e; } }
this.BuildRequest(args,action) makes sure all the parameters are setup like that before I call amcli.feeds.search which is amazon-mws:
{ FeedSubmissionId: 'xxxxxxxxxxxx', Version: '2009-01-01', Action: 'GetFeedSubmissionResult', SellerId: 'xxxxxxxxxxxx', MWSAuthToken: 'xxxxxxxxxxxx', 'MarketplaceIdList.Id.1': 'xxxxxxxxxxxx' }

Unable to search items by sku

GetLowestPricedOffersForSKU,
GetCompetitivePricingForSKU,
GetLowestOfferListingsForSKU,
GetLowestPricedOffersForSKU,
GetMyPriceForSKU,
GetProductCategoriesForSKU.

All return "XXXXX-XXXX-XX is an invalid SellerSKU for marketplace XXXXXXX".
Have tried all marketplaces and a wide variety of skus that are currently in use and not examples, including skus that my actual products have so I know for a fact some of them are valid. There is a chance this is on amazons end but seems rather unlikely as I have not seen many mentions of this issue.

Orders error missing headers

I am trying to figure out how to get the StatusCode and timestamp from the Headers of an error response. Is this even possible? When logging out the response and error when throttled, there is no StatusCode or Header fields that I can see.

Code:

const params = {
    Version: '2013-09-01',
    Action: 'ListOrders',
    SellerId: process.env.SELLER_ID,
    'MarketplaceId.Id.1': 'ATVPDKIKX0DER',
    MWSAuthToken: process.env.MWS_TOKEN,
    LastUpdatedAfter: '2018-12-14T00:00:00.000Z',
};

amazonMws.orders.search(params, (error, response) => {
    console.log(response);
    console.log(error);
});

Logged in the console:

null
{
  Type: { },
  Code: 'RequestThrottled',
  Message: 'Request is throttled',
  RequestId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
}

Key must be a buffer error

Hi, I get this error when I try to use orders.search

error  TypeError: Key must be a buffer
    at new Hmac (crypto.js:117:16)
    at Object.createHmac (crypto.js:643:10)
    at Constructor._request (/home/jay/src/megabuildlab/mws-data-service/node_modules/amazon-mws/lib/AmazonMwsResource.js:331:47)
    at Constructor.<anonymous> (/home/jay/src/megabuildlab/mws-data-service/node_modules/amazon-mws/lib/AmazonMwsMethod.js:88:18)
    at Constructor.search (/home/jay/src/megabuildlab/mws-data-service/node_modules/amazon-mws/lib/AmazonMwsMethod.js:37:33)

Not compatible on Lambda Node.js 8.10

I have one lambda node.js 8.10 function of importing just this module.
But it gets module initialization error on Lambda.

This issue needs to be fixed ASAP.

Here are some details:

'use strict';

var mws = require('amazon-mws')(process.env.ACCESS_KEY_ID, process.env.SECRET_ACCESS_KEY);

module.exports.handler = async event => {
    console.log(JSON.stringify(event));

    return;
};

Of course, I am setting environment variables correctly and cofirmed.
This simple code will get error on Lambda.

I attached CloudWatch log for this lambda function.
screen shot 2018-07-11 at 7 24 01 pm

listOrders lists wrong timeframe

I'm trying to request amazon orders with your listOrders example. I want to request orders with the parameter CreatedAfter. After changing this parameter in your function call, the call seems to ignore 'After' and always responses with the 'Before' parameters. It's similar with LastUpdateAfter and Before parameter.

How can we solve this issue?

XML as JSON attributes in GetLowestPricedOffersForSKU response

I am trying to pull data from the GetLowestPricedOffersForSKU products api call, but I appear to be getting XML as JSON attributes in the response. Here the first few lines of the response I am getting:
{"data":[{"<?xml version=\"1.0\"?><GetLowestPricedOffersForSKUResponse xmlns=\"http://mws.amazonservices.com/schema/Products/2011-10-01\">":" <GetLowestPricedOffersForSKUResult MarketplaceID=\"ATVPDKIKX0DER\" SKU=\"20180219_StVincentDePaul@Seneca_16\" ItemCondition=\"Used\" status=\"Success\">"},{"<?xml version=\"1.0\"?><GetLowestPricedOffersForSKUResponse xmlns=\"http://mws.amazonservices.com/schema/Products/2011-10-01\">":" <Identifier>"},{"<?xml version=\"1.0\"?><GetLowestPricedOffersForSKUResponse xmlns=\"http://mws.amazonservices.com/schema/Products/2011-10-01\">":" <MarketplaceId>ATVPDKIKX0DER</MarketplaceId>"},{"<?xml version=\"1.0\"?><GetLowestPricedOffersForSKUResponse xmlns=\"http://mws.amazonservices.com/schema/Products/2011-10-01\">":" <SellerSKU>20180219_StVincentDePaul@Seneca_16</SellerSKU>"},{"<?xml version=\"1.0\"?><GetLowestPricedOffersForSKUResponse xmlns=\"http://mws.amazonservices.com/schema/Products/2011-10-01\">":" <ItemCondition>Used</ItemCondition>"},{"<?xml version=\"1.0\"?><GetLowestPricedOffersForSKUResponse xmlns=\"http://mws.amazonservices.com/schema/Products/2011-10-01\">":" <TimeOfOfferChange>2018-07-13T22:18:20.937Z</TimeOfOfferChange>"},{"<?xml version=\"1.0\"?><GetLowestPricedOffersForSKUResponse xmlns=\"http://mws.amazonservices.com/schema/Products/2011-10-01\">":" </Identifier>"}...

Properly handling status codes / errors?

What is the best way to handle status codes / errors?

I don't see anything in the docs about errors. I'm most interested in 500 status codes coming from MWS servers so I know I can retry. The problem is I cannot replicate a 500 status code from MWS. I'm also not sure how you're handling 500 status codes. The only place I've been able to find the status codes MWS returns is when a successful "response" is sent back in the "lastResponse.statusCode. When an "error" is sent back it's missing the status code. The only thing available for the "error" is the "code" which can be different depending on the API your calling. Does the "code" sent back in the "error" always correspond to the api doc error handling? Is there a better way for me to search for status codes rather than code messages? Does a 500 status code return an "error" or a "response"? Thanks so much for your help!

Breaking change with v0.0.19, `ASIN` and `status` fields removed from root of results

This is an example from GetMyPriceForASIN, but I believe the same change applies to all product info operations. A couple fields were removed from the results.

[
  {
    "ASIN": "B01BICBEQ2", // <-- NO LONGER PRESENT
    "status": "Success",  // <-- NO LONGER PRESENT
    "Product": {
      "Identifiers": {
        "MarketplaceASIN": {
          "MarketplaceId": "A1F83G8C2ARO7P",
          "ASIN": "B01BICBEQ2"
        }
      },
      "Offers": {}
    }
  }
]

I've already fixed on my end. Just for your info or others who may have problems after upgrade. Any breaking changes should be noted with a semver major version release.

Amazon MWS returning corrupted chars

I noticed that some characters gets corrupted when I use GetReport, these characters should be non-ascii characters like apostrophes and the degree one, indeed when I download the flat file from Seller Central characters are right.
Using hex editor I noticed that these characters are always EF BF BD when using amazon-mws, but they should represent a variety of characters.

This is an example of a GetReport of GET_FLAT_FILE_ORDERS_DATA
amazonmwsissue
In this screenshot ship-address-1 should be 'Via del Gesù', other characters are corrupted in this report.
Thanks for your time, this issue apart, this library is awesome.

How to handle Amazon throttling

Hello,
I have observed we do not get the headers in the response of Amazon using this API. This means i cannt handle throttling since the info is not passed, and i think the library itself dont handle it.

Please tell me how to get the headers or how to handle it.

thanks

ListOrders adding LastUpdateBefore parameter

I am constructing my request for ListOrders with the following parameters:

// mws params used by all listorders requests
    const mwsParams = {
        Version: '2013-09-01',
        SellerId: sellerId,
        'MarketplaceId.Id.1': 'ATVPDKIKX0DER',
    };

    // send ListOrders request
    const listOrdersRequest = () => amazonMws.orders.search({
        ...mwsParams,
        Action: 'ListOrders',
        MWSAuthToken: mwsToken,
        LastUpdatedAfter: lastUpdatedAfter,
    });

I will sometimes get the following response:

{ 
     Type: 'Sender',
     Code: 'InvalidParameterValue',
     Message:  'The LastUpdatedAfter date is after the LastUpdatedBefore date.',
     RequestId:  '4afa4c76-dcca-4f00-b720-feaa3b37e067' 
} 

This leads me to believe that the client is creating the LastUpdatedBefore parameter without my passing the parameter to orders.search. If anyone can shed some light on how to prevent the parameter from getting added to my request or offer some helpful insight as to what is going on here, I would truly be thankful. I'm really stumped how to proceed.

My intent is to send a request to the endpoint to get orders updated since the timestamp taken from the last time I sent the request

Error: ContentMD5DoesNotMatch

Thank you for this library. It's really useful.

i am getting "the Content-MD5 HTTP header you passed for your feed did not match the Content-MD5 we calculated for your feed" when try to SubmitFeed.

My codes are here;

 const data = 'sku	product-id	product-id-type	price	minimum-seller-allowed-price	maximum-seller-allowed-price	item-condition	add-delete	fulfillment-center-id	batteries_required	supplier_declared_dg_hz_regulation1
  test-node	9782749920306	4	250,00	250,00	250,00	11	a	AMAZON_EU	FALSE	not_applicable';
   
fse.writeFileSync('/amazon-book/data.txt', data);
var FeedContent = fse.readFileSync('/amazon-book/data.txt', 'UTF-8');

try {
      const response = await amazonMws.feeds.search({
        'Version': '2009-01-01',
        'Action': 'SubmitFeed',
        'SellerId': SELLER_ID,
        'MWSAuthToken': MWS_AUTH_TOKEN,
        'MarketplaceId': MARKET_PLACE_ID,
        'FeedType': '_POST_FLAT_FILE_INVLOADER_DATA_',
        'FeedContent': FeedContent,
        'PurgeAndReplace': false
      });

      console.log("RESPONSE:", response);

    } catch (error) {

      console.log("ERROR:", error);
    }

i used FeedSubmit successfully on scratchpad.
i checked AmazonMwsResource.js file. The ContentMD5 as same as scratchpad.

i don't understand where is the wrong? But i am getting this error...

Could you help me, please ?

Other Amazon MWS Regions e.g. EU - overriding DEFAULT_HOST?

How do I properly override line 4 of amazon-mws.js

AmazonMws.DEFAULT_HOST = 'mws-eu.amazonservices.com';

Other Regions, namely EU (Germany, UK, etc.) need to connect to that host to get their data, otherwise, with the same Secret and MWS Token, we only get a 401 access denied

There's a way to request GET_CATEGORY_LISTINGS_DATA ?

Good afternoon.

There's any way to get the items by category report? I have alredy enabled this feature in my seller account contacting with amazon, and i can get this report from sellercentral, but i don't know how to request it from this tool (How to pass the category parameter, because if you don't provide one cat, you will break the amazon function). I don't found nothing about it in forums or documentation, only the query

I would be very grateful if someone could help me.

Thanks a lot for your time and this amazing tool.

signature doesn't match

hi there,

I'm lopping a search report (Report Request List) (to get the generated id when ready) in a setInterval but one the second run (and beyond) I get a 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.'

Code:

const paramCheckReportStatus = {
        Version: '2009-01-01',
        Action: 'GetReportRequestList',
        SellerId: sellerID,
        MWSAuthToken: 'MWS_AUTH_TOKEN',
        'ReportRequestIdList.Id.1': ReportRequestId,
    };

 setInterval(() => {
        amazonMws.reports.search(paramCheckReportStatus, (error, response) => {
            if (error) {
                console.log('error ', error);
            }
            console.log('response', response);
        });
    }, 5000);

What am I missing here?

Thanks

PS: I verified the ReportRequestId and it's correct (I'm first running the submit report and getting the response)

Breaking Change: keys named "Value" replaced by "_"

Keys named "Value" have been replaced with "_" in all output. Example from GetCompetitivePricingForASIN

Before:

 "NumberOfOfferListings": {
          "OfferListingCount": [
            {
              "condition": "New",
              "Value": "21"
            },
            {
              "condition": "Any",
              "Value": "21"
            }
          ]
        }
      }

After:

"NumberOfOfferListings": {
          "OfferListingCount": [
            {
              "_": "21",
              "condition": "New"
            },
            {
              "_": "11",
              "condition": "Used"
            },
            {
              "_": "32",
              "condition": "Any"
            }
          ]
        }
      }

After fixing this, you should record raw XML output from specific MWS API calls and run that through your tests to ensure the JSON output never changes between builds.

JSON output isn't in the expected JSON format.

I see, you are using xml2json but the JSON output isn't most appealing and easy to use.

For eg:
I get the response like below
[ { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <ListInventorySupplyResult>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <MarketplaceId>MarketplaceId</MarketplaceId>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <InventorySupplyList>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <member>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <Condition>NewItem</Condition>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <SupplyDetail/>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <TotalSupplyQuantity>1447</TotalSupplyQuantity>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <EarliestAvailability>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <TimepointType>Immediately</TimepointType>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' </EarliestAvailability>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <FNSKU>FNSKU</FNSKU>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <InStockSupplyQuantity>147</InStockSupplyQuantity>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <ASIN>ASIN</ASIN>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <SellerSKU>SellerSKU</SellerSKU>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' </member>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' </InventorySupplyList>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' </ListInventorySupplyResult>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <ResponseMetadata>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' <RequestId>5ome-24ndom-id</RequestId>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': ' </ResponseMetadata>' }, { '<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">': '</ListInventorySupplyResponse>' } ]

While expected format is:

{"ListInventorySupplyResponse":{"xmlns":"http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/","ListInventorySupplyResult":{"MarketplaceId":"MarketplaceId","InventorySupplyList":{"member":{"Condition":"NewItem","SupplyDetail":{},"TotalSupplyQuantity":"1447","EarliestAvailability":{"TimepointType":"Immediately"},"FNSKU":"FNSKU","InStockSupplyQuantity":"1447","ASIN":"ASIN","SellerSKU":"SellerSKU"}}},"ResponseMetadata":{"RequestId":"5ome-24ndom-id"}}}'
`

Is this fine and expected result?

Thanks

MWS AUTH Token

How to access all the API's through MWS_AUTH_TOKEN without providing access_key and secret_key, as I have studied in amazon document that with out key's you can access the api's with the help of MWS_AUTH_TOKEN

Can you help me out with small example, as i have never seen in you existing code with such functionality as you have already saved the access_key and secret_key. I don't want to use the both

GetMyFees Estimate error

let accessSecret = process.env.AWS_SECRET_ACCESS_KEY;

const amazonMws = require("amazon-mws")(accessKey, accessSecret);

let feesLookUp = async (req, res) => {
  const { ASIN, inputPrice } = req.body;
  //   console.log("res", ASIN, inputPrice);

  await amazonMws.products.searchFor(
    {
      Version: "2011-10-01",
      Action: "GetMyFeesEstimate",
      SellerId: process.env.MWS_SELLER_ID,
      "FeesEstimateRequestList.FeesEstimateRequest.1.MarketplaceId":
        process.env.MWS_MARKETPLACE_ID,
      "FeesEstimateRequestList.FeesEstimateRequest.1.IdType": "ASIN",
      "FeesEstimateRequestList.FeesEstimateRequest.1.IdValue": "ASIN",
      "FeesEstimateRequestList.FeesEstimateRequest.1.IsAmazonFulfilled": true,
      "FeesEstimateRequestList.FeesEstimateRequest.1.Identifier": "Hello",
      "FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.ListingPrice.CurrencyCode":
        "USD",
      "FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.ListingPrice.Amount": inputPrice,
      "FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.Shipping.CurrencyCode":
        "USD",
      "FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.Shipping.Amount":
        "0",
      "FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.Points.PointsNumber":
        "0",
      "FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.Points.PointsMonetaryValue.Amount":
        "0",
      "FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.Points.PointsMonetaryValue.CurrencyCode":
        "USD"
    },
    function(error, response) {
      console.log("res2", response);

      if (error) {
        console.log("error products", error);
        return;
      }
      console.log("response ", response);
    }
  );
};

module.exports = {
  feesLookUp
};

I have tried alot of different possibilities with strings and no strings but no luck. This is my error which is internal here and my scratchpad works. I also got ListMatchingProducts to work so i know my keys are fine. Also the console log is null but my req.body is consoled log from postman just fine.

  Headers:
   { 'x-mws-quota-max': '36000.0',
     'x-mws-quota-remaining': '35997.0',
     'x-mws-quota-resetson': '2019-02-13T02:52:00.000Z',
     'x-mws-timestamp': '2019-02-13T02:03:05.895Z',
     'content-type': 'unknown',
     'content-charset': 'unknown',
     'content-length': 'unknown',
     'content-md5': 'unknown',
     date: 'Wed, 13 Feb 2019 02:03:05 GMT' },
  StatusCode: 500 }```

Access Denied Error

Hi,

I am trying to use below mws api using this module. But getting Access Denied error. But things are working fine if I use the same api with same parameters using scratchpad.

var amazonMws = require('amazon-mws')('AWS_ACCESS_KEY_ID','Sec_key');

amazonMws.products.searchFor({
'Version': '2011-10-01',
'Action': 'GetLowestPricedOffersForSKU',
'SellerId': 'SellerID',
'MWSAuthToken': 'authtoken',
'MarketplaceId': 'A21TJRUUN4KGV',
'SellerSKU': 'skuid',
'ItemCondition': 'New'
}, function (error, response) {
if (error) {
console.log('error ', error);
return;
}
console.log('response ', response);
});

Response:

error { Type: 'Sender',
Code: 'AccessDenied',
Message: 'Access denied',
Headers:
{ 'x-mws-quota-max': 'unknown',
'x-mws-quota-remaining': 'unknown',
'x-mws-quota-resetson': 'unknown',
'x-mws-timestamp': '2018-09-22T16:16:09.909Z',
'content-type': 'text/xml',
'content-charset': 'unknown',
'content-length': '294',
'content-md5': 'unknown',
date: 'Sat, 22 Sep 2018 16:16:09 GMT' },
StatusCode: 401,
RequestId: '3511e62f-29e6-4112-bcb1-c938de071192' }

overrideHost clairfication

Howdy Bhushankumar

Line 363 here I can see we have:

var host = self.overrideHost || self._AmazonMws.getApiField('host');

But how on earth do I override/set the host value before making the request?

Matt

GetFeedSubmissionResult, 'ErrorResponse' of undefined

when i use GetFeedSubmissionResult action, i get this error.

C:\amazon-book\server\node_modules\amazon-mws\lib\AmazonMwsResource.js:302
if (response.ErrorResponse) {
^
TypeError: Cannot read property 'ErrorResponse' of undefined
at C:\amazon-book\server\node_modules\amazon-mws\lib\AmazonMwsResource.js:302:38
at C:\amazon-book\server\node_modules\amazon-mws\lib\AmazonMwsResource.js:204:28
at ParserStream. (C:\amazon-book\server\node_modules\amazon-mws\lib\AmazonMwsResource.js:165:26)
at emitOne (events.js:116:13)
at ParserStream.emit (events.js:211:7)
at spreadArgs (C:\amazon-book\server\node_modules\fast-csv\lib\extended.js:43:25)
at ParserStream.emit (C:\amazon-book\server\node_modules\fast-csv\lib\parser\parser_stream.js:325:13)
at onwriteError (_stream_writable.js:412:12)
at onwrite (_stream_writable.js:440:5)
at ParserStream.afterTransform (_stream_transform.js:90:3)
at C:\amazon-book\server\node_modules\fast-csv\lib\parser\parser_stream.js:223:21
at ParserStream._parseLine [as _parse] (C:\amazon-book\server\node_modules\fast-csv\lib\parser\parser_stream.js:196:13)
at ParserStream._transform (C:\amazon-book\server\node_modules\fast-csv\lib\parser\parser_stream.js:221:18)
at ParserStream.Transform._read (_stream_transform.js:186:10)
at ParserStream.Transform._write (_stream_transform.js:174:12)
at doWrite (_stream_writable.js:397:12)
at writeOrBuffer (_stream_writable.js:383:5)
at ParserStream.Writable.write (_stream_writable.js:290:11)
at Readable.ondata (_stream_readable.js:639:20)
at emitOne (events.js:116:13)
at Readable.emit (events.js:211:7)
at Readable.read (_stream_readable.js:475:10)

image

my codes are here;

 try {
      var FeedSubmissionId = "50052017808";
      const response = await amazonMws.feeds.search({
        'Version': '2009-01-01',
        'Action': 'GetFeedSubmissionResult',
        'SellerId': SELLER_ID,
        'MWSAuthToken': MWS_AUTH_TOKEN,
        'FeedSubmissionId': FeedSubmissionId
      });

      console.log("RESPONSE:", response);
    } catch (error) {
      console.log("ERROR:", error);
    }

GetLowestPricedOffersForASIN returns xml value instead of object

Thank you for developing this module. I looked up bunch of modules out there and this is by far the best I tried so far. It helped my workflow a lot. Thank you.

I however had some issues with specific apis and was wondering if you can help me. Thanks in adance.

GetLowestPricedOffersForASIN result returns xml instead of clean object. same with offerforSKU.

`{
"data": [
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <GetLowestPricedOffersForASINResult MarketplaceID="ATVPDKIKX0DER" ItemCondition="New" ASIN="B0792JK6K6" status="Success">"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " ATVPDKIKX0DER"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " B0792JK6K6"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " New"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 2018-08-28T04:31:46.412Z"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": "

"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 7"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <OfferCount condition="new" fulfillmentChannel="Amazon">2"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <OfferCount condition="new" fulfillmentChannel="Merchant">5"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <LowestPrice condition="new" fulfillmentChannel="Amazon">"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 24.40"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 24.40"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 0.00"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <LowestPrice condition="new" fulfillmentChannel="Merchant">"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 24.40"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 20.00"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 4.40"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <BuyBoxPrice condition="New">"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 24.40"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 24.40"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 0.00"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 25"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <OfferCount condition="new" fulfillmentChannel="Amazon">2"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <OfferCount condition="new" fulfillmentChannel="Merchant">5"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": "
"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " new"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 91.0"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 15875"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <ShippingTime minimumHours="24" maximumHours="48" availabilityType="NOW"/>"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 20.00"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 4.40"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " TX"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " US"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " false"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " false"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " true"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " new"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 100.0"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 254402"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <ShippingTime minimumHours="0" maximumHours="0" availabilityType="NOW"/>"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 24.40"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 0.00"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " true"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " true"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " true"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " new"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 98.0"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 7883"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <ShippingTime minimumHours="24" maximumHours="24" availabilityType="NOW"/>"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 24.95"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 0.00"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " false"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " false"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " true"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " new"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 99.0"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 107221"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <ShippingTime minimumHours="0" maximumHours="0" availabilityType="NOW"/>"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 25.00"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 0.00"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " true"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " false"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " true"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " new"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 94.0"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 7617"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <ShippingTime minimumHours="24" maximumHours="48" availabilityType="NOW"/>"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 25.00"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 0.00"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " UT"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " US"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " false"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " false"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " true"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " new"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 90.0"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 292"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <ShippingTime minimumHours="24" maximumHours="48" availabilityType="NOW"/>"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 27.55"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 0.00"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " GB"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " false"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " false"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " true"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " new"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 97.0"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 73"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " <ShippingTime minimumHours="144" maximumHours="240" availabilityType="NOW"/>"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 61.00"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " USD"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " 0.00"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " AZ"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " US"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " false"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " false"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " true"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">": "

"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01\">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01\">": " 886afe0c-82c1-411a-8438-9d765d37a28f"
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01\">": " "
},
{
"<GetLowestPricedOffersForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01\">": ""
}
],
"Headers": {
"x-mws-quota-max": "200.0",
"x-mws-quota-remaining": "197.0",
"x-mws-quota-resetson": "2018-08-28T06:20:00.000Z",
"x-mws-timestamp": "2018-08-28T05:37:57.796Z"
}
}`

csv reports with delimiter ","

error in reports with delimiter "," for example SC_VAT_TAX_REPORT .
report GET_VAT_TRANSACTION_DATA work fine, but this report has delimiter "\t".

Access denied

Hi,

I'm always getting access denied although the credentials are correct since I've tested the same credentials with https://github.com/beardon/mws-api and the MWS Scratchpad

My Code:

const { MWS } = require("../config/dev.js");

const account = "XXXXXX"
const amazonMws = new MwsApi();

amazonMws.setApiKey(
  process.env.AWS_ACCESS_KEY_ID,
  process.env.AWS_SECRET_ACCESS_KEY
);


amazonMws.orders.search(
  {
    Version: "2013-09-01",
    Action: "ListOrders",
    SellerId: MWS.merchantId[account], //"SELLER_ID",
    MWSAuthToken: MWS.authToken, //"MWS_AUTH_TOKEN",
    "MarketplaceId.Id.1": MWS.MarketplaceId.de, //"MARKET_PLEACE_ID_1",
    LastUpdatedAfter: new Date(2018, 09, 24)
  },
  function(error, response) {
    if (error) {
      console.log("error ", error);
      return;
    }
    console.log("response", response);
  }
);
error products { Type: 'Sender',
  Code: 'AccessDenied',
  Message: 'Access denied',
  Headers:
   { 'x-mws-quota-max': 'unknown',
     'x-mws-quota-remaining': 'unknown',
     'x-mws-quota-resetson': 'unknown',
     'x-mws-timestamp': '2018-10-06T14:09:38.212Z',
     'content-type': 'text/xml',
     'content-charset': 'unknown',
     'content-length': '294',
     'content-md5': 'unknown',
     date: 'Sat, 06 Oct 2018 14:09:38 GMT' },
  StatusCode: 401,
  RequestId: '4ef544f5-810c-4a98-8654-2682f131b007' }

Get the listing product with Report

Hello,

I can not retrieve a report of all products from a sellercentral account with this method:

    var ReportRequestId = '10101010XXX';
    amazonMws.reports.search({
        'Version': '2009-01-01',
        'Action': 'GetReportRequestList',
        'SellerId': 'SELLER_ID',
        'MWSAuthToken': 'MWS_AUTH_TOKEN',
        'ReportRequestIdList.Id.1': ReportRequestId
    }, function (error, response) {
        if (error) {
            console.log('error ', error);
            return;
        }
        console.log('response', response);
    });  

It returns to me this:

"HasNext": "false",
         "ReportRequestInfo": {
             "ReportType": "_GET_MERCHANT_LISTINGS_ALL_DATA_",
                 "ReportProcessingStatus": "_SUBMITTED_",
                 "EndDate": "2019-03-26T09:16:33+00:00",
                 "Scheduled": "false",
                 "ReportRequestId": "64163017981",
                 "SubmittedDate": "2019-03-26T09:16:33+00:00",
                 "StartDate": "2019-03-26T09:16:33+00:00"
             },
     "ResponseMetadata": {
             "RequestId": "d2cab60e-30a5-47d1-8555-248c313bb0a6"
             },
     "Headers": {...},
"StatusCode": 200
}

I do not have the ReportId in the request response

That should have returned to me this:

<GetReportListResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
  <GetReportListResult>
    <HasNext>false</HasNext>
    <ReportInfo>
      <ReportType>_GET_MERCHANT_LISTINGS_ALL_DATA_</ReportType>
      <Acknowledged>false</Acknowledged>
      <ReportId>15521486795017981</ReportId>
      <ReportRequestId>64163017981</ReportRequestId>
      <AvailableDate>2019-03-26T09:16:44+00:00</AvailableDate>
    </ReportInfo>
  </GetReportListResult>
  <ResponseMetadata>
    <RequestId>03e99980-121c-4df9-a69c-58eb4c606094</RequestId>
  </ResponseMetadata>
</GetReportListResponse>

How to setup Content-type on SubmitFeed?

I am uploading a product to FR using a SubmitFeed with FlatFile,it works.Great!
But,I found some garbled text, like " santé". Actually,it is "santé".
This is my code:
image

It may be the reason for content-type,i want to setup content-type="text/tab-separated-values; charset=iso-8859-1" try fix it.

Settlement Report not parsing XML to JSON.

Reports API, action: "GetReport", type: "GET_V2_SETTLEMENT_REPORT_DATA_XML" report does not parse the XML data to JSON. The issue is presenting itself in the "AmazonMwsResource.js" file inside function "processResponseType" on line 172 of version 0.0.19. It's seeing the content-type as "plain/text" although amazon is responding with XML data. The res.headers['content-type'] is showing as "plain/text". This is what's causing the problem because it causes the if statement on line 172 to fail which means the xml2js parser never runs. The "else" statement runs instead which tries to parse XML data using a CSV parser. If the same request is run through MWS scratchpad amazon responds with a res.headers['content-type'] of "text/xml" which is correct and would allow the XML2JS parser to run. Now sure if for some reason amazon is responding with the wrong content-type or if the content-type is accidentally being changed somewhere.

fail to load more than 100 inventory (SignatureDoesNotMatch error)

Dear Bhushankumar,

I tried this example below with some codes changed,

https://github.com/bhushankumarl/amazon-mws/blob/master/examples/javaScript/fulfillmentInventory/listInventorySupply.js

We have 160+ ASINs in our store, but I was only able to fetch 100 of them before getting an error.

below is the code, please can you help check?

//----------------------code starts-----------------------------

var auth = require("./auth");
var amazonMws = require('amazon-mws')(auth.accessKey,auth.secretKey);

var query = {
'Version': '2010-10-01',
'Action': 'ListInventorySupply',
'SellerId': auth.sellerID,
'MWSAuthToken': auth.token,
'MarketplaceId': auth.marketplaceID,
'QueryStartDateTime': new Date(01, 04, 2018)
}

var nextQuery = {

'SellerId': auth.sellerID,
'MarketplaceId': auth.marketplaceID,
'Version': '2010-10-01',
"AWSAccessKeyId": auth.token,
'MWSAuthToken': auth.token,
'Path': "/FulfillmentInventory/2010-10-01"

}

function listInventory(query){

amazonMws.fulfillmentInventory.search(query, function (error, response) {
    if (error) {

    	console.log(nextQuery);

        console.log('error ', error);
        return;
    }else{

    	// console.log(response);

    	var members = response.InventorySupplyList.member;

    	console.log("------------------------------");
    	console.log(members.length);
    	console.log("------------------------------");

    	for (var i = members.length - 1; i >= 0; i--) {
    		console.log(members[i]);
    	}

    	try{

			var nextToken = response.NextToken;

			console.log("------------------------------");

			console.log(nextToken);

			console.log("------------------------------");


			nextQuery["NextToken"] = nextToken;
			nextQuery["Action"] = "ListInventorySupplyByNextToken";


			listInventory(nextQuery);


		}catch(e){


			console.log("All Fetched.");
		}

    }
    
});

}

listInventory(query);

//----------------------code ends-----------------------------

and here is the error msg I get:

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.',

I appreciate your kind attention to this issue. Thank you so very much!

"500 - Server Error" response from MWS crashes Node

Occasionally MWS is spitting back this in response to an otherwise correct request:

<?xml version="1.0"?>
<ErrorResponse>
    <Error>
        <Type>Server</Type>
        <Code>500</Code>
        <Message>500 - Server Error</Message>
        <Detail />
    </Error>
</ErrorResponse>

In that case this library crashes with this error message, instead of returning proper error JSON:

 { Error: Invalid JSON received from the AmazonMws API
    at Constructor._Error (/home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/Error.js:12:19)
    at Constructor (/home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/utils.js:85:19)
    at new Constructor (/home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/utils.js:85:19)
    at IncomingMessage.<anonymous> (/home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/AmazonMwsResource.js:286:23)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  type: undefined,
  stack: 'Error: Invalid JSON received from the AmazonMws API\n    at Constructor._Error (/home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/Error.js:12:19)\n    at Constructor (/home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/utils.js:85:19)\n    at new Constructor (/home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/utils.js:85:19)\n    at IncomingMessage.<anonymous> (/home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/AmazonMwsResource.js:286:23)\n    at emitNone (events.js:111:20)\n    at IncomingMessage.emit (events.js:208:7)\n    at endReadableNT (_stream_readable.js:1064:12)\n    at _combinedTickCallback (internal/process/next_tick.js:138:11)\n    at process._tickCallback (internal/process/next_tick.js:180:9)',
  rawType: undefined,
  code: undefined,
  param: undefined,
  message: 'Invalid JSON received from the AmazonMws API',
  detail: undefined,
  raw:
   { message: 'Invalid JSON received from the AmazonMws API',
     response: '',
     exception: TypeError: Cannot read property 'toLowerCase' of undefined
    at processResponseType (/home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/AmazonMwsResource.js:181:75)
    at IncomingMessage.<anonymous> (/home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/AmazonMwsResource.js:219:21)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9) } }

There should be a proper catch added to handle MWS server errors.

Accents in SKU / Name - Not decoded

Greetings. I've noticed that when i request and get the items from a report listing (for example, merchant report), some sku's have accents in it, but not decoded. Example:

"Champú anticaspa" --> "Champ� anticaspa".

In seller central it's displayed properly. This it's happening with product-names too when i get merchant report items.

I've tried decoding the XML in my javascript, but without results.

Thanks so much.

Throttling headers are set to unknown

Not sure if a bug, or expected behaviour. But the headers for throttling always return unknown for the GetOrder command.

  Headers:
   { 'x-mws-quota-max': 'unknown',
     'x-mws-quota-remaining': 'unknown',
     'x-mws-quota-resetson': 'unknown',
     'x-mws-timestamp': '2018-06-06T17:57:30.568Z' } }

MalformedInput

The library works fine for some, including, ListOrders, but when I try to get the product information. I get the following error. I used the example code provided.

SenderMalformedInputStart of list found where not expectede8dcf91f-b0f0-481a-b732-0ff53c7dff62

GetFeedSubmissionResult: error parsing response

This is a result for a _POST_FLAT_FILE_PRICEANDQUANTITYONLY_UPDATE_DATA_ feed. I submitted the command exactly per the example in the README.

It is probably best if you just return the text response without trying to parse it.

MWS:AmazonMwsResource params { host: 'mws-eu.amazonservices.com', port: '443', path: '/Feeds/2009-01-01?&Version=2009-01-01&Action=GetFeedSubmissionResult&SellerId=XXX&MWSAuthToken=aXXX&FeedSubmissionId=873376017828&AWSAccessKeyId=XXX&Timestamp=2018-10-24T07%3A05%3A47.706Z&SignatureVersion=2&SignatureMethod=HmacSHA256&Signature=XXX', method: 'GET', headers: { 'Content-Type': 'text/xml', 'Content-MD5': 'XetHVN5ukbNI7W0ibK4SLA==' } }  +0ms
  MWS:AmazonMwsResource self.body ''  +2ms
  MWS:AmazonMwsResource ----------- Received Response ------------- +1s
  MWS:AmazonMwsResource responseString  Feed Processing Summary:
        Number of records processed             2
        Number of records successful            2

 +6ms
  MWS:AmazonMwsResource contentType  text/plain +1ms
  MWS:AmazonMwsResource statusCode  200 +0ms
  MWS:AmazonMwsResource It is NON-XML Response, so considered it as CSV file +6ms
  MWS:AmazonMwsResource error  Error: Unexpected Error: column header mismatch expected: 1 columns got: 4
    at ParserStream.self.__transform (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:138:48)
    at ParserStream.__parseLineData [as __handleLine] (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:65:18)
    at /home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:90:22
    at asyncIterator (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/extended.js:13:17)
    at Function.asyncEach (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/extended.js:31:10)
    at ParserStream.__processRows (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:88:18)
    at /home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:186:34
    at headerHandler (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:157:13)
    at ParserStream.__parseLineData [as __handleLine] (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:82:20)
    at ParserStream.__processHeaders (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:168:18)
    at ParserStream._parseLine [as _parse] (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:182:26)
    at ParserStream._transform (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:221:18)
    at ParserStream.Transform._read (_stream_transform.js:186:10)
    at ParserStream.Transform._write (_stream_transform.js:174:12)
    at doWrite (_stream_writable.js:397:12)
    at writeOrBuffer (_stream_writable.js:383:5) +19ms
  MWS:AmazonMwsResource error  TypeError: Cannot read property 'ErrorResponse' of undefined
    at /home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/AmazonMwsResource.js:300:38
    at /home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/AmazonMwsResource.js:204:28
    at ParserStream.<anonymous> (/home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/AmazonMwsResource.js:165:26)
    at emitOne (events.js:121:20)
    at ParserStream.emit (events.js:211:7)
    at spreadArgs (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/extended.js:43:25)
    at ParserStream.emit (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:325:13)
    at ParserStream.self.__transform (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:138:34)
    at ParserStream.__parseLineData [as __handleLine] (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:65:18)
    at /home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:90:22
    at asyncIterator (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/extended.js:13:17)
    at Function.asyncEach (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/extended.js:31:10)
    at ParserStream.__processRows (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:88:18)
    at /home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:186:34
    at headerHandler (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:157:13)
    at ParserStream.__parseLineData [as __handleLine] (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:82:20) +1ms
/home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/AmazonMwsResource.js:300
                        if (response.ErrorResponse) {
                                     ^

TypeError: Cannot read property 'ErrorResponse' of undefined
    at /home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/AmazonMwsResource.js:300:38
    at /home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/AmazonMwsResource.js:204:28
    at ParserStream.<anonymous> (/home/colin/localdev/ecommerce/ab-mws/node_modules/amazon-mws/lib/AmazonMwsResource.js:165:26)
    at emitOne (events.js:116:13)
    at ParserStream.emit (events.js:211:7)
    at spreadArgs (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/extended.js:43:25)
    at ParserStream.emit (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:325:13)
    at onwriteError (_stream_writable.js:412:12)
    at onwrite (_stream_writable.js:440:5)
    at ParserStream.afterTransform (_stream_transform.js:90:3)
    at /home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:223:21
    at ParserStream._parseLine [as _parse] (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:196:13)
    at ParserStream._transform (/home/colin/localdev/ecommerce/ab-mws/node_modules/fast-csv/lib/parser/parser_stream.js:221:18)
    at ParserStream.Transform._read (_stream_transform.js:186:10)
    at ParserStream.Transform._write (_stream_transform.js:174:12)
    at doWrite (_stream_writable.js:397:12)

GetFeedSubmissionResult error

First of all, thanks for this useful piece of software.

async function getFeedResult(amazonAcc, feedId) {
try {
var request = {
'Version': '2009-01-01',
'Action': 'GetFeedSubmissionResult',
'SellerId': amazonAcc.sellerId,
'MWSAuthToken': amazonAcc.MWSAuthToken,
'FeedSubmissionId': feedId
}
var res = await amazonMws.feeds.search(request);
return res;
}
catch (err) {
console.log("Error AmazonUpload.getFeedResult");
throw (err);
}
}
I'm trying to get a FeedSubmissionResult as per the documentation but I get this error:

node_modules/amazon-mws/lib/AmazonMwsResource.js:269
response.Headers = ResponseHeaders;
^

TypeError: Cannot set property 'Headers' of undefined

The credentials are okay, other feed calls are working okay, the call was successful from the amazon scratchpad https://mws.amazonservices.com/scratchpad/index.html .

Seems response is undefined but not sure why. Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.