Skip to content
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

auth.resetPasswordForEmail throws AuthRetryableFetchException when SMTP settings are wrong #902

Closed
devj3ns opened this issue Apr 24, 2024 · 5 comments
Labels
auth This issue or pull request is related to authentication bug Something isn't working

Comments

@devj3ns
Copy link

devj3ns commented Apr 24, 2024

Describe the bug
When the auth SMTP settings are wrong/invalid in the Supabase dashboard and the auth.resetPasswordForEmail(...) function is invoked, it throws an AuthRetryableFetchException. This kind of AuthException is very generic and not helpful at all.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the supabase dashboard and use invalid SMTP credentials
  2. invoke the auth.resetPasswordForEmail function
  3. AuthRetryableFetchException is thrown

Expected behavior
I would expect the function to return an Exception that tells the client what is gone wrong. Examples would be a InvalidSMTPCredentials or more generic a ServerException with an error message.

Expected behavior

The following code inside this repository is responsible for this:

// If the status is 500 or above, it's likely a server error,

Version:
????????? supabase_flutter 2.5.1
??? ????????? supabase 2.1.1
??? ??? ????????? functions_client 2.0.0
??? ??? ????????? gotrue 2.6.0
??? ??? ????????? postgrest 2.1.1
??? ??? ????????? realtime_client 2.0.4
??? ??? ????????? storage_client 2.0.1

Additional context
With debugging, I found out that under the hood the following json is returned by the server in my case: {"code":500,"error_code":"unexpected_failure","msg":"Unable to process request","error_id":"87968bc5f6e035ed-FRA"}

@devj3ns devj3ns added the bug Something isn't working label Apr 24, 2024
@dshukertjr dshukertjr added the auth This issue or pull request is related to authentication label Apr 25, 2024
@devj3ns
Copy link
Author

devj3ns commented Jun 25, 2024

I am having the same problem again, but now because of an error with a postgres hook.

When logging in, the auth.signInWithPassword function throws an AuthRetryableFetchException which does not contain any details about the error. By adding a print statement inside the supabase_flutter code before the exception is thrown, I could see that the actual error coming from the backend has the following body:

{code: 500, error_code: unexpected_failure, msg: Error running hook URI: pg functions://postgres/public/custom_access_token_hook, error_id: 8994bc8f030e912e-FRA}

I would expect that the AuthRetryableFetchException would at least contain the error message, but it does not.

If I find some time in the next days, I will create a PR to fix this.

@Vinzent03
Copy link
Collaborator

Where exactly did you put the print statement?

@devj3ns
Copy link
Author

devj3ns commented Jun 29, 2024

Where exactly did you put the print statement?

At the top of the _handleError method. (here)

@Vinzent03
Copy link
Collaborator

Unknown errors are now properly stored in the thrown exception, so the dev can see the cause. (Not released yet). So I think this issue can be closed now.

@devj3ns
Copy link
Author

devj3ns commented Jul 2, 2024

Unknown errors are now properly stored in the thrown exception, so the dev can see the cause. (Not released yet). So I think this issue can be closed now.

Perfect, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth This issue or pull request is related to authentication bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants