Closed Kinzi closed 4 years ago
Seems like this happens when you hit the request limit of the API.
Hi @Kinzi, I got the same error. Did you find a way to solve or at least try/catch it?
@MaiKaY Check out my fork. Not super elegant but at least it allows me to catch the error:
https://github.com/Kinzi/amazon-pa-api50
@arifulhb Happy to make a pull request out of this if you like it ;)
Hay, @Kinzi great to know you had time to fix the issue. Please send the PR and I'll just marge it.
@arifulhb @MaiKaY already did ;)
I'm not 100% when this happens but it's probably on an empty or faulty response from the API:
It happens in those lines when
searchItemsResponse
is undefined:https://github.com/arifulhb/amazon-pa-api50/blob/d089c45e9d83ef6d5abcf392507eb0bd8e7db2fc/src/index.js#L180-L181
So I guess it's either checking if
searchItemsResponse
actually is a JSON object or making sureProductAdvertisingAPIv1.SearchItemsResponse.constructFromObject(data)
does not return anything else.