Supabase Auth returns email_address_invalid for an existing confirmed user
#51652
Replies: 6 comments 2 replies
|
This error comes from Auth's email validation, before any email is sent. So the problem is the email address itself, not the user account. Check these:
select email, length(email), email ~ '\s' as has_space
from auth.users where id = '<user-id>';
To restore access without losing the user's data, set a new password from your backend using the service role key: await supabase.auth.admin.updateUserById(userId, { password: 'new-temp-password' })Then let the user change it after signing in. |
|
One additional check: if the email address belongs to a legitimate production domain, I would investigate the exact address being passed to Supabase Auth before changing the user account.
I would avoid deleting or recreating the user, since that could complicate existing data relationships. I would also avoid changing the password as the first diagnostic step: it may provide a workaround, but it would not explain why both email-based endpoints reject the address. Have you confirmed whether the affected email domain is a normal production domain rather than a reserved or test domain? |
|
Additional diagnostic information from the Supabase Auth logs:
The request is reaching the hosted Supabase Auth service, but the email address is rejected. The stored email has no whitespace, and the domain is lowercase and has MX records. Could someone help determine why the hosted Auth service rejects this existing, confirmed user's email address? |
|
Based on the additional details, I would treat this as a hosted email-validation-path issue rather than a problem with the In the current Supabase Auth code, That fits your symptoms quite well:
So I would not delete or recreate the user. That would risk breaking references without addressing the validator that is rejecting the address. A useful isolation test would be:
If immediate account recovery is required and you control the project, an admin password update can restore password-based access while preserving the same user ID and relationships, but I would treat that only as a workaround — it will not resolve the underlying email validation problem. Given the evidence so far, I think Supabase Support needs to check why the hosted validator is classifying |
|
One thing nobody has mentioned yet, for when emails do go out: your log shows the request came from http://localhost:3000. Supabase uses the Site URL (Authentication → URL Configuration) as the default address in confirmation and password-reset emails, and the docs say to change it from http://localhost:3000 to your production URL: https://supabase.com/docs/guides/auth/redirect-urls. If it still says localhost, the reset link will open localhost even after support fixes the validation. Also worth quoting in the ticket: the error list describes email_address_invalid only as "Example and test domains are currently not supported" (https://supabase.com/docs/guides/auth/debugging/error-codes), which doesn't fit a real company domain, so they need to say which rule rejected it. |
|
I went through the Auth (GoTrue) source to see which checks can produce this exact response, and it narrows things down quite a bit. The 400
The code also rules out two other suspects:
So the most likely explanation is that the hosted email-validation service is rejecting this specific address. That's a per-address verdict you can't see or change from the dashboard, so it needs Supabase support. In the ticket, it helps to include your log ID and the result of testing a second address on Restoring access now, without changing the account
const { data, error } = await supabaseAdmin.auth.admin.generateLink({
type: 'magiclink', // or 'recovery'
email: 'nico.caruccio@cgmstampa.it',
options: { redirectTo: 'https://your-app.example.com/after-login' },
})
// data.properties.action_link: deliver it to the user through your own channel( One caveat: I can only read the open-source code, not the hosted configuration, so support has to confirm the service's verdict. Going by the code, though, nothing in your user record or DNS setup can produce this error. |
Uh oh!
There was an error while loading. Please reload this page.
Hello everyone,
I'm troubleshooting a Supabase Auth issue in a project on the Free plan.
An existing, confirmed user can no longer sign in. Both password recovery (/auth/v1/recover) and magic-link authentication (/auth/v1/magiclink) return the error email_address_invalid.
The user still exists in auth.users, and the account is confirmed. The email domain has an MX record, and the MX hostname resolves to multiple IP addresses.
The project uses the hosted Supabase Auth service. I have not deleted or recreated the user because I need to preserve the existing account and its related data.
I have also checked the Auth logs and confirmed that the recovery and magic-link requests fail with HTTP 400 and the error code email_address_invalid.
Has anyone encountered this issue with an existing, confirmed user? What should I check next to identify the root cause and safely restore access?
Project reference: jhkwptjwhlsatixpazzo
Supabase support ticket: SU-507202
Thank you for your help.
All reactions