#JACKSON
1 messages · Page 1 of 1 (latest)
Since both req_oJofDf7RbgmJmk and req_GdG7PEqTfLNXTS share the same idempotency (https://stripe.com/docs/api/idempotent_requests), this means that the request was retried.
When the automatic retries is configured on Stripe library, the request would be retried if the request fails due to a transient problem: https://github.com/stripe/stripe-ruby#configuring-automatic-retries
Or if your system set idempotency on your own in the request, it can also create a new request ID, but only perform the operation once from the previous request.
So if I wanted it to not re-try and instead error out if the request fails, I would just need to set Stripe.max_network_retries to 0?
By default, Stripe.max_network_retries is 0 (no retry) if your code didn't configure it
I didn't have it configured, so should it not have retried it then?
Did you server configure idempotency with your own internal retry system?
no we do not
we don't send idempotency keys.
Just make the call to the .create method and then rescue a Stripe::StripeError in the method
subscription = Stripe::Subscription.create(data)
This is likely that the library has other retry mechanism. With idempotency key, the request will only have the operation once and it shouldn't affect your integration. Did you face any issue with this?
yeah what happened is it looks like it retried the request but the retry was outside of the execution of our code so it was unable to save the data from the successful response. hence the subscription's ID did not get saved to our database and was therefore lost
req_GdG7PEqTfLNXTSt was replayed and the response had the same subscription ID as req_oJofDf7RbgmJmk. If your code handled the response of subscription correctly, either of them will have the same subscription ID
when its "replayed", does it behave like a single API call? like from start to finish its only executing once?
yes, you can test this out yourself if you want to see how it works
Nonetheless, I am curious why it still retried even though river said by default its set to 0 (no retry). We don't have any overrides in the initializer to specify otherwise.
the only possible reason here is that network retries have been set somewhere in your code, maybe you'd want to take some time to look through it again?
Loading development environment (Rails 7.0.4.3)
2.7.7 :001 > Stripe.max_network_retries
=> 0
our max network retries is set at 0
Also, why was the request retried if both of them responded with a 200 code?
If there is connection issue such as timeout that the response isn't returned in time (even though it's successful), it might retry to get the response for the previous request