bgamari / trac-to-remarkup

Moved to GitLab: https://gitlab.haskell.org/bgamari/trac-to-remarkup
https://gitlab.haskell.org
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Email is already taken #36

Closed tdammers closed 5 years ago

tdammers commented 5 years ago

Sometimes, GitLab will refuse to create a user because some other user already uses the same email address. However, just prior, the script asks for the user by the exact same address, and doesn't find anything. Example log entry:

FIND-OR-CREATE-USER [tickets:669] redacted@redacted.de
FIND-USER [tickets:669] redacted@redacted.de
FIND-USER-BY [tickets:669] redacted@redacted.de
FIND-USER-BY [tickets:669] not found
FIND-USER-BY [tickets:669] redacted@redacted.de
FIND-USER-BY [tickets:669] not found
FIND-USER-BY [tickets:669] trac-redacted
FIND-USER-BY [tickets:669] not found
CREATE-USER [tickets:669] redacted@redacted.de
CREATE USER [tickets:669] "redacted@redacted.de" ("redacted@redacted.de")
ERROR [tickets] Failed to execute ticket mutation: FailureResponse (Response {responseStatusCode = Status {statusCode = 409, statusMessage = "Conflict"}, responseHeaders = fromList [("Server","nginx"),("Date","Mon, 18 Feb 2019 08:52:12 GMT"),("Content-Type","application/json"),("Content-Length","42"),("Connection","keep-alive"),("Cache-Control","no-cache"),("Vary","Origin"),("X-Content-Type-Options","nosniff"),("X-Frame-Options","SAMEORIGIN"),("X-Request-Id","7d21ac62-6dec-4200-be38-d6cad3c3b298"),("X-Runtime","0.107019")], responseHttpVersion = HTTP/1.1, responseBody = "{\"message\":\"Email has already been taken\"}"})

In other words, asking GitLab for a user with email or username redacted@redacted.de yields no results, but then when we try to create a user with that exact email address, GitLab tells us that the email is already taken.

tdammers commented 5 years ago

Further investigation shows that the emails in question are indeed in use; so the question is why GitLab doesn't find them when we query for them.

tdammers commented 5 years ago

Found it! There are two API calls, one for finding users by username or email, and one for finding users only by username. Guess which one we were using...