Recent searches
No recent searches
[Support API] [Bug] Merging Users is not atomic
Posted Dec 07, 2021
I'm trying to merge two users, each with different emails and external_id. Say User_1 has email 1@ex.com and external_id 1, and User 2 has email 2@ex.com and external_id 2.
Immediately after that, I want to know the resulting user's identities. I would expect the answer to be two identities, one for the email 1@ex.com and one for the email 2@ex.com. But the API is only returning one of them.
1
6
6 comments
Greg Katechis
Hi Santiago! The issue that you're running into here is that users with external IDs cannot be merged. In order to merge these users, you would need to first remove the external IDs and then you could proceed with the merge.
0
Santiago Gandolfo
But in my tests, the merge is working. If I add a 10 seconds delay between doing the merge and making the request for the user's identities (or another request like updating some information from the merged user), then it works just fine (of course this workaround would not be acceptable as a valid solution for the software that we are trying to build because of the large amount of requests that we are making). Are you saying that if I deleted the user's external_id before doing the merge, then the merge would be fully made before the response is returned and I could Immediately be able to make the other requests?
0
Greg Katechis
Hi Santiago! I just checked in both the agent interface and via Postman that I am unable to merge two end-users with external IDs. Could you share the steps that you are using to accomplish this?
To answer your other question, this would not be possible, since the response is simply to the user (with their default identity) and not to the identities endpoint. You could run a script/create an app/middleware that takes the user ID of the "winning" user after the merge and list that user's identities.
0
Santiago Gandolfo
1
Travis Siems
Hi Joseph James Greg Katechis,
I have the same issue as Santiago: when merging users, I cannot immediately fetch the user and see the changes. If I wait a couple seconds, then I can see the changes. Is there a way to merge users using the API and ensure that it is an atomic change before receiving the response?
I'm curious what the result of Santiago's fix was because it may be similar to mine.
Thanks!
0
Santiago Gandolfo
Hi Travis!
We didn't find a fix, we were forced to add a complex workaround that consists in adding the process that we needed to run after the merge in a delay queue, so that we can dequeue it only after the delay time has passed.
If you found a better solution please tell me to check if it simplifies our code.
Cheers!
0