ScaleLeap / amazon-mws-api-sdk

A fully typed TypeScript and Node.js Amazon MWS API Unofficial SDK
https://npm.im/@scaleleap/amazon-mws-api-sdk
MIT License
20 stars 12 forks source link

Amazon doesn’t detect calls from this SDK when accounting for inactivity #169

Closed m-dierker closed 4 years ago

m-dierker commented 4 years ago

Hello! This is a bit of a funky report, and I don’t have a clear answer for the cause just yet. :)

My MWS account was activated on 7/22. The next day I received a ticket that my account would be shut down in 30d for no activity within 60d. I made a test call with this library, received a successful response, and figured that would be the end of it.... but Amazon replied to my ticket and said they still didn’t detect any MWS calls. I tried a few more methods, and all returned successful responses but it still didn’t count as activity on Amazon’s side. I was stumped for a while... until I realized it might be this library. I downloaded the Java version of Amazon’s native SDK, ran the sample with the same keys, and support responded a couple hours later saying I’d made a MWS call.

I have a hunch that there is probably a difference in the XML produced by the native SDK and this library, but haven’t had time to dig in. The only thing the Amazon SDK required that this didn’t was application name and version, both of which were freeform strings. Maybe they silently don’t count calls without them? The way to debug would probably be to compare request XML.

This bug is technically on Amazon’s side since the request should either be rejected or work+count for activity, but given this library is new and others may encounter the issue, I wanted to report. If y’all have a Slack or Discord or something, happy to chat more in real-time on what specific calls I made if helpful.

moltar commented 4 years ago

Hi Matthew,

This all sounds very strange.

Do you mind sharing your code?

Thank you.

moltar commented 4 years ago

Also, to help Amazon support to track down a request, you may want to include the request ID from the metadata response object (second in the response tuple).

Docs: https://github.com/ScaleLeap/amazon-mws-api-sdk/tree/master/docs#request-metadata

m-dierker commented 4 years ago

Thanks for the update. Completely agree this generally makes no sense. :) Unfortunately I don't have an answer.

I expected the ScaleLeap API to be sending XML so I could compare directly, but it seemed like that's not quite what was happening. Here are the requests:

Amazon's library:

<GetMyFeesEstimateRequest xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">
    <SellerId>SELLER_ID_REMOVED</SellerId>
    <MWSAuthToken>TOKEN_REMOVED</MWSAuthToken>
    <FeesEstimateRequestList>
        <FeesEstimateRequest>
            <MarketplaceId>ATVPDKIKX0DER</MarketplaceId>
            <IdType>ASIN</IdType>
            <IdValue>B01JZQPWA2</IdValue>
            <PriceToEstimateFees>
                <ListingPrice>
                    <CurrencyCode>USD</CurrencyCode>
                    <Amount>50</Amount>
                </ListingPrice>
            </PriceToEstimateFees>
            <Identifier>1596843536934md</Identifier>
        </FeesEstimateRequest>
    </FeesEstimateRequestList>
</GetMyFeesEstimateRequest>

ScaleLeap Library:

AWSAccessKeyId=REMOVED&Action=GetMyFeesEstimate&FeesEstimateRequestList.FeesEstimateRequest.1.IdType=ASIN&FeesEstimateRequestList.FeesEstimateRequest.1.IdValue=B01JZQPWA2&FeesEstimateRequestList.FeesEstimateRequest.1.Identifier=1596843536934md&FeesEstimateRequestList.FeesEstimateRequest.1.IsAmazonFulfilled=true&FeesEstimateRequestList.FeesEstimateRequest.1.MarketplaceId=ATVPDKIKX0DER&FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.ListingPrice.Amount=50&FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.ListingPrice.CurrencyCode=USD&MWSAuthToken=TOKEN_REMOVED&SellerId=SELLER_ID_REMOVED&Signature=SIGNATURE_REMOVED&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2020-08-07T23%3A44%3A02.793Z&Version=2011-10-01

Sadly no obvious differences. :(

and here's my ScaleLeap code:

const mwsHttp = new HttpClient({
  marketplace: amazonMarketplaces.US,
  awsAccessKeyId: AWS_ACCESS_KEY_ID,
  mwsAuthToken: MWS_ACCOUNT_AUTH_TOKEN,
  secretKey: MWS_SECRET,
  sellerId: MWS_SELLER_ID,
});
const mws = new MWS(mwsHttp);

(async function () {
  let fees;
  try {
    fees = await mws.products.getMyFeesEstimate({
      FeesEstimateRequestList: [
        {
          IdType: 'ASIN',
          IdValue: 'B01JZQPWA2',
          Identifier: `${Date.now()}md`,
          IsAmazonFulfilled: true,
          MarketplaceId: amazonMarketplaces.US.id,
          PriceToEstimateFees: {
            ListingPrice: {Amount: 50, CurrencyCode: 'USD'},
          },
        },
      ],
    });
  } catch (e) {
    console.error(e);
  }
  console.log(JSON.stringify(fees));
})();

If no one else is seeing this issue, it's totally fine to leave this issue alone or close it for now -- however you want to triage. I figured I would file anyways so other new API users who hit the same issue might catch it if it's the library. If it does wind up being some difference with what this library is sending, I'll find out in ~30d when Amazon files another inactivity ticket. Otherwise... maybe it was just a new account issue on Amazon's end. :)

moltar commented 4 years ago

That is very peculiar that their own library goes against the docs, which provide the GET query request approach, and not the POST XML approach.

@justinemmanuelmercado can you please take a look at this, and see if the other libraries (C#, PHP) use the query or XML post approach?

@mvd7793 btw, we also do set the user-agent header, and the value is @scaleleap/amazon-mws-api-sdk/1.0.0 (Language=JavaScript) (in case you want to reference that in the ticket to Amazon in the future).

Also, just to be clear, you are getting the correct response from the API, right? Meaning that there are no errors, or anything funky.

If no one else is seeing this issue, it's totally fine to leave this issue alone or close it for now -- however you want to triage. I figured I would file anyways so other new API users who hit the same issue might catch it if it's the library. If it does wind up being some difference with what this library is sending, I'll find out in ~30d when Amazon files another inactivity ticket. Otherwise... maybe it was just a new account issue on Amazon's end. :)

Please continue with the issues!

They are highly appreciated. Because we built this library largely following the docs, as we aren't using all of the parts of the API in production. But we decided to build our all of the API calls for completeness, as we will be using them later.

So, some of the parts aren't "battle tested" and the docs may and do sometimes deviated from reality.

m-dierker commented 4 years ago

Yep- the calls themselves all work fine. No errors or anything else different. Will keep filling any inconsistencies I find.

moltar commented 4 years ago

Closing this as it is not actionable for time being. Feel free to add comments if you find anything else related to this and we can re-open.