bhushankummar / amazon-mws

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

Submitting post product feed csv giving errors. Please help. #112

Closed tylerreece22 closed 4 years ago

tylerreece22 commented 4 years ago

After looking through the codebase and the issues it seemed the submitFeed function just took a .csv file. Am I missing something?

Code

amazonMws.feeds.submit({
            'Version': '2009-01-01',
            'Action': 'SubmitFeed',
            'FeedType': clientFeedType,
            'FeedContent': fileContent,
            'SellerId': process.env.MERCHANT_ID,
        }, function (error, submitFeedResponse) {

Response

{
  "AmazonEnvelope": {
    "xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
    "xsi:noNamespaceSchemaLocation": "amzn-envelope.xsd",
    "Header": {
      "DocumentVersion": "1.02",
      "MerchantIdentifier": "xxxxxxx"
    },
    "MessageType": "ProcessingReport",
    "Message": {
      "MessageID": "1",
      "ProcessingReport": {
        "DocumentTransactionID": "50412018214",
        "StatusCode": "Complete",
        "ProcessingSummary": {
          "MessagesProcessed": "0",
          "MessagesSuccessful": "0",
          "MessagesWithError": "1",
          "MessagesWithWarning": "0"
        },
        "Result": {
          "MessageID": "0",
          "ResultCode": "Error",
          "ResultMessageCode": "5001",
          "ResultDescription": "XML Parsing Fatal Error at Line 1, Column 1: Content is not allowed in prolog. Content is not allowed in prolog."
        }
      }
    }
  },
  "ResponseMetadata": {},
  "Headers": {
    "x-mws-quota-max": "60.0",
    "x-mws-quota-remaining": "59.0",
    "x-mws-quota-resetson": "2019-11-14T02:18:00.000Z",
    "x-mws-timestamp": "2019-11-14T02:01:54.827Z",
    "content-type": "text/xml",
    "content-charset": "utf-8",
    "content-length": "1060",
    "content-md5": "mRCq8BSOmFqvfC492JtX6w==",
    "date": "Thu, 14 Nov 2019 02:01:54 GMT"
  },
  "StatusCode": 200
}
tylerreece22 commented 4 years ago

Issue was with my file format. I forgot to include the header and follow the template provided in the docs.