bent0b0x / amazon-mws

MIT License
14 stars 8 forks source link

Timestamp to be recorded not explicitly made available #6

Open trss opened 6 years ago

trss commented 6 years ago

Quoting from http://docs.developer.amazonservices.com/en_US/dev_guide/DG_ResponseFormat.html:

Important: You should record and retain for 30 days the RequestId and Timestamp for every request that you submit to Amazon MWS. Doing this enables Amazon to diagnose and fix any problems that you might encounter, helping to improve your experience using Amazon MWS. Without this information, requests to Amazon MWS support will take longer to resolve.

This timestamp is quietly set at https://github.com/bent0b0x/amazon-mws/blob/master/amazon.js#L15 and so I'm currently storing options.params.Timestamp immediately after making the call but this appears fragile. So the timestamp could be made explicitly available or this method of storing it could be documented.

EDIT: Line number update in latest code: https://github.com/bent0b0x/amazon-mws/blob/master/amazon.js#L26

bent0b0x commented 6 years ago

@trss thanks for reporting this. I can take a look in a few days and try to get this resolved!

bent0b0x commented 6 years ago

@trss would you want the timestamp to be explicitly passed in (and fall back to Date.now() if not passed in)?

Let me know what you think would work best for you. For backwards compatibility, I think allowing a user to optionally pass in a timestamp works, but let me know if you think there is a more ideal solution!

EDIT: actually that may not ideal because that seemingly would require the user of this package to perform the .toISOString() operation themselves.

🤔 how exactly are you grabbing options.params.Timestamp right now? I don't immediately see in the code how that is being exposed