#kurt85_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1285233794164588584
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- kurt85_api, 4 days ago, 13 messages
not sure if this may be a bad use of the library, but we are reusing the same RequestObject instance for these consecutive calls, however it only fails in our staging environment not on single tests:
RequestOption requestOptions = RequestOptions.builder()
.setApiKey(.......).build();
try {
Invoice invoice =
Invoice.create(invoiceCreateParams, requestOptions)
.addLines(addLinesParams, requestOptions)
.finalizeInvoice(finalizeParams, requestOptions);
log.debug("Created an invoice with id: {}", invoice.getId());
this.updatePaymentIntent(invoice, requestOptions);
return invoice;
} catch (StripeException e) {
....
Hi there ๐ will need a bit to dig into this, but so far it looks like there is a lock on the Customer object, that is being held by another request to add Invoice Items.
ok, that makes sense, we may be using the same customer id in parallel requests
It's actually a little tricky for me to look at this, you're making so many requests for this Customer in a relatively short time period that I'm able to see everything well on my side ๐
Is it possible you have multiple staging flows reusing this same Customer that could be cluttering things?
yeah, this error arises when we run our testing suite, and I just confirmed with our QA Engineer that we are using the same customer id, so if you say that the locks are at customer level it makes sense
however, we are setting retries as I mentioned in the original message but I don't see it in the dashboard, is it expected?
also it would be great if you can advise regarding this #1285233794164588584 message
I'm working on double checking, but I believe automatic request retries only happen if there is a network problem that causes the response to the request to have not been received. The object locks do respond to the request, with an expected status (even if that outcome is unexpected from a process viewpoint).
Yeah, intermittent network or other non-deterministic errors.
https://github.com/stripe/stripe-java?tab=readme-ov-file#configuring-automatic-retries
Your code will need to detect and gracefully handle the 429 returned in the situation you're experiencing.
Which part is being reused here, the requestOptions?
yes
I believe that's fine
According to these other docs it should be already covered by the library: https://docs.stripe.com/rate-limits#object-lock-timeouts
Lock timeouts have a different cause than rate limiting, but their mitigations are similar. As with rate limiting errors, we recommend retrying on an exponential backoff schedule (see Handling limiting gracefully). But unlike rate limiting errors, the automatic retry mechanisms built into Stripeโs SDKs retry 429s caused by lock timeouts:
can you confirm if you can see retries for the same request on your side?
Oh, good spot, sorry I forgot about that.
should the retries be visible on the dashboard?
Hm, I'm not seeing any retries. I only see one request using that idempotency key.
can you see the reponse headers for that request? Only request headers are shown on the dashboard, I don't see the response ones
Not quickly, maybe with some digging. Why are you asking about the response headers?
because according to the docs, the library would retry or not depending on the should_retry response header
as we don't see retries I want to confirm if it is coming in the response
we will also do changes in our test suite to use different customer ids
๐ stepping in and catching up
So yeah we perform those retries under the hood in this case.
You don't see separate API requests for that
You basically just handle this end-result.
So I can see in our logs that retries did occur based on your retry settings with the SDK
But the lock was for too long so it still timed out