bhushankummar / amazon-mws

Amazon MWS NodeJS Wrapper
MIT License
197 stars 78 forks source link

GetFeedSubmissionResult error #58

Closed b07 closed 5 years ago

b07 commented 5 years ago

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

bhushankummar commented 5 years ago

@b07 Thank you, I will check and get back to you.

bhushankummar commented 5 years ago

@b07 I did check that. Everything is working perfectly. Can you please try with export DEBUG=MWS:* and send me what output comes in?

b07 commented 5 years ago

https://pastebin.com/BQLCbaE1

It seems the call is making it through, receives a response (which is the same as I tried with the scratch-pad) but not parsing it correctly?

In this case I've only uploaded 2 orders, where one had an error warning (although the client confirmed it was uploaded successfully) but that shouldn't matter should it?

Thank you for the quick response.

bhushankummar commented 5 years ago

@b07 It's because of instead of the tab-delimited response, it provides the raw response. You can try below request.

    var FeedSubmissionId = '10101010XXX';
    amazonMws.feeds.search({
        'Version': '2009-01-01',
        'Action': 'GetFeedSubmissionResult',
        'SellerId': 'SELLER_ID',
        'MWSAuthToken': 'MWS_AUTH_TOKEN',
        'FeedSubmissionId': FeedSubmissionId,
        __RAW__: true
    }, function (error, response) {
        if (error) {
            console.log('error ', error);
            return;
        }
        console.log('response', response);
    });

https://github.com/bhushankumarl/amazon-mws/blob/master/examples/javaScript/feeds/getFeedSubmissionResultRaw.js

b07 commented 5 years ago

Thank you very much for your help on this.