New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating a new user with an already used e-mail address returns error 400 with no clear status #10026
Comments
Directus returns an Error 400 with the following error message in the response body. {
"errors": [
{
"message": "Field \"email\" has to be unique.",
"extensions": {
"code": "RECORD_NOT_UNIQUE",
"collection": "directus_users",
"field": "email",
"invalid": "duplicate@email.com"
}
}
]
} Please check on the response body, you may have to surround your API request with |
Hey wie hebben we daar! Alles lekker Tristan? I'll close this for now, as the detailed error can be found in the API response, which in turn allows for proper error handling in the end project. |
@rijkvanzanten Gaat lekker hoor :) Met jou ook zo te merken ;) We did wrap the whole request in a try-catch, as we do with all our async calls. This is the third project I'm using Directus on and I have not encountered this issue before, only after migrating the current project we are working on to latest Directus version. I'm putting my colleague on it to try different methods so we can present you with more details and examples. |
@ravolta-io that works! I don't think anything changed around error returning or its structure since the early alpha versions, so it should be good from that end. |
Preflight Checklist
Describe the Bug
Registering a new user with a POST to /users works fine, but if the email is already in use Directus just returns a 400 error. When setting LOG_LEVEL="debug", the Directus log shows 'Field "email" has to be unique".
Expected behaviour would be to return the proper error codes so error handling can be correctly implemented on the client side.
To Reproduce
Errors Shown
No response
What version of Directus are you using?
9.0.1
What version of Node.js are you using?
16.13.0
What database are you using?
MySQL
What browser are you using?
React Native / Expo
What operating system are you using?
macOS
How are you deploying Directus?
Google Cloud
The text was updated successfully, but these errors were encountered: