amzn / selling-partner-api-models

This repository contains OpenAPI models for developers to use when developing software to call Selling Partner APIs.
Apache License 2.0
585 stars 730 forks source link

[BUG] [SP-API] [Issue] shipping API v2 returns error - sandbox returns expected data #2664

Closed old-wolf-ma closed 11 months ago

old-wolf-ma commented 1 year ago

I'm submitting a...

[ ] Regression (a behavior that used to work and stopped working in a new release)
[x ] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

SP-API Name and Version or Report/Feed Type

Shipping API v2 getRates POST https://sellingpartnerapi-na.amazon.com/shipping/v2/shipments/rates Getting Rates for On-Amazon orders ("channelType":"AMAZON") works correctly Getting Rates for Off-Amazon ("channelType":"EXTERNAL") Returns an Error on production endpoint but works on sandbox endpoint

Expected Behavior

Sending the following should return rates available for this EXTERNAL (off-Amazon) shipment { "channelDetails": { "channelType":"EXTERNAL" }, "packages":[ { "dimensions": { "height":6, "length":17, "unit":"INCH", "width":9 }, "insuredValue": { "unit":"USD", "value":50.00 }, "items":[ { "quantity":1, "weight": { "unit":"POUND", "value":20 } } ], "packageClientReferenceId":"530600-1", "weight": { "unit":"POUND", "value":20 } } ], "shipFrom": { "addressLine1":"--- Broadway", "city":"--------", "countryCode":"US", "email":"--------@-----------.com", "name":"My Word!", "phoneNumber":"888-555-6666", "postalCode":"-----", "stateOrRegion":"MA" }, "shipTo": { "addressLine1":"--- WESTWOOD PLZ", "city":"-----------", "countryCode":"US", "name":"----------------", "postalCode":"xxxxx-xxxx", "stateOrRegion":"CA" } }

Current Behavior

every attempt for channelType EXTERNAL, and I have made many, returns the following error { "errors": [ { "code": "InternalFailure", "message": "We encountered an internal error. Please try again.", "details": "" } ] } Attempts made to the sandbox endpoint work.
Attempts with channelType AMAZON for on-amazon orders also work

Context/Screenshots

I have been working on this on and off for a couple weeks. I have added all optional fields and removed all optional fields and then tried adding and removing optional fields singly and in in groups and as long as the transaction appears correct, I get the same error as above. I have even put intentional errors in to see if I could get more details. When I add intentional errors, I get the appropriate responses pointing to the error.

NA-Dev commented 1 year ago

I am also having an issue where I get the Internal error response. For me it happens after a certain number of pages when fetching all our shipments in a loop using nextToken. Amazon API support tickets don't help because they just piddle around for weeks only to come back and say nothing is wrong. Then they ask me for a new request ID to get them to look into it again. Very infuriating.

old-wolf-ma commented 1 year ago

Hi Nikki, It sounds like you might be having a RateLimit issue, have you checked the return headers for the "x-amzn-RateLimit-Limit:" value on all transactions to make sure you are pausing long enough between requests. I would also look to see if you are getting a quota exceeded error. I do the same thing for orders and shipments and I had to add a code to handle rate limiting as well as quota exceeded to avoid errors. Even when following the rate limits, I would get quota exceeded when looping through orders or shipments depending on the number of requests, it would usually happen after processing between 20 and 30 orders. I Hope this helps

chrisskhoury commented 1 year ago

Hello @old-wolf-ma,

I tried to check the issue, but unfortunately with the info you provided it is not enough for me to debug internally. Can you please open a developer support case with the request-id and timestamp there, so that we can fetch the logs for it? The info shared here is not enough to provide you with a solution.

Many thanks,

Chris Solution Architect, SP API

chrisskhoury commented 11 months ago

resolving, feel free to reopen if issue persists