bhushankummar / amazon-mws

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

Concurrent SumbitFeed requests fail because of md5 value. #140

Open VTTodorov opened 4 years ago

VTTodorov commented 4 years ago

Im sending about 20 concurrent requests using Promise.all. The code looks like this: let amazonMws = require('amazon-mws')(KEY, SECRET) let promises = []; for (...) { promise.push(amazonMws.feeds.submit(...)); } let results = await Promise.all(promises);

Result: Often 1 or more of those 20 requests return error with message: "the Content-MD5 HTTP header you passed for your feed did not match the Content-MD5 we calculated for your feed". I'm 99% sure that the error is caused because the library keeps its RequestHeaders object as a parameter for the amazonMws instance. Any idea how to prevent getting those errors without having to instantiate new amazon-mws instance for each call?

PS. Instantiating new instance for each concurrent call fixes the issue.

bhushankummar commented 3 years ago

@VTTodorov Sure, I will review it. Please feel free to add if you have suggestions on this.

hoangtrucit commented 3 years ago

I have same problem when use multiple instance.