-
Notifications
You must be signed in to change notification settings - Fork 321
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
Allow exception created by a user inside of a trigger function to bubble up when using signUp/signIn #271
Comments
Transferring this to our GoTrue server as it will need to be handled there first. Some code for testing from silentworks:
However, I think we wouldn't want anything leaking from the database so we should only bubble up the error under specific instances. PostgREST has a good way of handling this - we should use the same so that it's consistent everywhere: https://postgrest.org/en/v8.0/api.html?highlight=exceptions#raise-errors-with-http-status-codes eg:
|
I think there is a second, related issue here - if a BEFORE trigger modifies the record to be inserted into the table, the API still returns the data that was passed in the request, NOT the data which was actually saved in the auth.users table. @kiwicopple Do you want a separate issue for that or can it be handled with this one? |
@chipilov that should be raised as a separate issue as it's not directly related to this one. |
🎉 This issue has been resolved in version 2.6.34 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Feature request
Is your feature request related to a problem? Please describe.
It would be good if an exception created by a user inside of a Postgres Trigger function would bubble all the way up to the client code. Currently, I have created an exception but I keep on getting the same default "Database error saving new user" error although I know the signUp process is failing due to my exception. I would prefer to see the message from my exception here.
Another related issue is that the confirmation email is sent before the record gets inserted into the database, not sure why this happens, because by raising an exception the database normally rollback all transactions so the email being sent shouldn't happen before the transaction is completed and successful.
The text was updated successfully, but these errors were encountered: