#sai_rez-object lock
1 messages · Page 1 of 1 (latest)
👋 happy to help
could you please share the request id that generated this error?
here's how you can find it https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
There isn't one in particular, it's something we've noticed being flagged through sentry. Here is one from today for example
req_NXmpCgHwSqm0ZA
ok I will take a look
Thanks!
No problem, do you need any more information for me?
This is the filter I applied to have find the errors
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
no I think I nailed it down, and I'm just trying to search in our logs to find more details, but I think you tried to change something about the payment method after creating a subscription involving that same payment method
That's interesting, could you explain what changed in the payment method so I could better track it down in our flow
I'm not entirely sure I would have to review the flow
So what you observed was that there was a subscription created with a payment method and around the same time a request was sent to update the same payment method?
basically the request was this req_7BJlYkMd5T3Jg1 updating an existing subscription with a default payment method (the one that caused the lock) basically because when you add a payment method(PM) to a subscription we try to authenticate the PM and we lock the object while we're doing the auth. if you try to update the PM before the auth ends then it's normal to end up with a lockout
I see, what's the best way to handle this, is there something we should be awaiting?
Would adding this to our code help
stripe.setMaxNetworkRetries(2);
to be honest, I'm not sure, I'd have to test it but I think that would be one way of handling the error
Is there a general rule as to when the errors occurs, for e.g we have some for requests made to subscriptions, customers, setup_intents etc..?
Hey, taking over here. Let me catch-up!
Have you seen the general API guidance on lock_timeout errors? https://stripe.com/docs/rate-limits#object-lock-timeouts
Yes I'm just trying to understand more about what causes it so we can adjust our flow properly
Tarzan, mentioned with add a PM to a subscription it becomes locked, does that happen with other calls for e.g. to subscriptions or customers?
I don't know an extensive list, but it's best to just assume that we could lock all objects during updates
So would you say short term it's best to use setMaxNetworkRetries and long term implement a queue?
It depends on your integration, what APIs you're calling, volume of traffic, etc. But if you're running into lock_timeout errors we'd recommend implement network retries and seeing if that alleviates the issue (I suspect it will)
Okay awesome, thanks for the information
np!