#adria_unexpected
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/1496766707497439364
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
hi there đź‘‹ give me a moment to catch up on your question
could you share with me the ID of API request you made (req_xxxx)?
as well as the customer ID (cus_xxxxx) you expected to be returned? I understand that you are trying to search for a customer object with the metadata value as "param1"
This is the request
req_471m6KOo37mU4b
It returns the customer with id cus_UNmMrQHjHfF0r7 as if it were a customer. I expected no customer to be found since that customer was deleted yesterday. Or, at least to return the customer as a deleted customer
Just to confirm, you are able to retrieve the customer using the Search endpoint despite the customer being deleted, right? I believe that's expected because the API reference does mentioned that deleted customers can still be retrieved through the API. So technically, you could still look up cus_UNmMrQHjHfF0r7 using GET /v1/customers/:id even though the customer is deleted
Yes, that right.
I'm not sure that's working as expected. If I retrieve that customer using /v1/customers/:id I get an object like this:
{
"id": "cus_UNmMrQHjHfF0r7",
"object": "customer",
"deleted": true,
}
This makes sense. However, if I retrieve that customer with search I don't get that object. I get the object of a customer as if it were a normal customer. That doesn't make sense imo because I need to do an extra request to /v1/customers/:id to verify if that customer is deleted or not.
I can assure you search didn't work like this before, it looks like a recent change
I just tested searching for Customers using metadata - i'm not seeing deleted customer being returned too.
That said, I'm not seeing a recent change made to the Search API at the moment
You mentioned that deleted customer used to return with Search API - could you share when you last tested this behaviour?
No, it’s the opposite. Search didn’t use to return deleted customers, and now it does.
Zooming out, we do not recommend using the Search API where strict consistency is necessary. Instead, you can listen for the customer.deleted event to be notified when a customer is deleted.
Search didn’t use to return deleted customers, and now it does.
This is the product behaviour I can't replicate. I just tested and my deleted customer doesn't return with the Search API.
I suspect this only happens with recently created customers, not older ones, but I haven’t verified it yet.
To reproduce it:
- Create a customer (don’t use an existing one)
- Delete it
- Wait whatever time you think is needed for Search results to update. This is the key point. Before, waiting 1 minute was enough. Now, even after 24 hours, the results are still inconsistent.
- Use Search to look for that customer
Hey! Taking over for my colleague. Let me catch up.
So to make sure I understand you correctly, when you do a search query for this customer cus_UNmMrQHjHfF0r7 you get it back in the response despite it's deleted ?
Can you share the request Id of the search API you did for this customer and share back the response body alongside all the response headers
Yes, that's the problem. It happens with all customers. It looks that the consistency in the search is not working fine (I've noticed this recently, it didn't happen before)
Here's the request:
req_471m6KOo37mU4b
{
"object": "search_result",
"data": [
{
"id": "cus_UNmMrQHjHfF0r7",
"object": "customer",
"address": null,
"balance": 0,
"created": 1776864396,
"currency": null,
"customer_account": null,
"default_source": null,
"delinquent": false,
"description": null,
"discount": null,
"email": "john.doe@example.com",
"invoice_prefix": "MTXA5OZ5",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {
"LoginId": "john.doe"
},
"name": "John Doe",
"next_invoice_sequence": 1,
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
}
],
"has_more": false,
"next_page": null,
"url": "/v1/customers/search"
}
let me do a quick test and double check this further...
Ok this part of the data freshness, usually it's 1 min I agree ... However don't use the search API for transactional cases (read after write scenarios). To make sure that you get the latest view of the object, make a get by its Id.
Ok, I'll just stop using the search API then because without eventual consistency I don't think it's useful. Thanks!