braintree / braintree_node

Braintree Node.js library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
334 stars 104 forks source link

retry on 502/503 (on 5xx maybe) #188

Closed kirillgroshkov closed 3 years ago

kirillgroshkov commented 3 years ago

General information

Issue description

I've noticed these kind of errors in our Sentry: image

Usually, for 99% of the 3rd-party services, we use HTTP api, where we have a setup that automatically retries on errors (on certain methods; using a fantastic https://github.com/sindresorhus/got library).

But Braintree node sdk recommends/forces us to use a client library instead of an HTTP API.

So far so good, but I believe it should still implement retry mechanisms (with exponential backoff or whatever is preferred by the Braintree http API), so it doesn't fail on such errors.

We can patch braintree SDK methods, of course, but there are so many of them, so it's largely inconvenient to do in the userland code.

So, I'm requesting to have this functionality in the sdk itself, as it should be a common practice.

kirillgroshkov commented 3 years ago

Another example. Different errors, but http status is still 5xx:

image

hollabaq86 commented 3 years ago

👋 @kirillgroshkov thanks for reaching out. I think you'll be better served using our GraphQL API. This way you don't have to worry about the SDK client library at all and can use our API directly.

If you continue to encounter 5xx errors, please contact Support.