-
Notifications
You must be signed in to change notification settings - Fork 372
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
"Database error granting user" on sign up/sign in #541
Comments
Hey @nstrelow - i know you said that it's inconsistent, but is there any way that you think we can reproduce this? Is it happening with one of the examples that we recommend in our documentation? |
Sorry, I have no way of reproducing, I will try and write down what happened, the next time I have it. Feel free to close this for more clarity and I'll reopen if I come across it again. Left this here to gather reports of similar problems, so we can gather more info. |
OK sure! I'll close but feel free to drop comments and I can reopen to debug once we have more info |
It is happening again and it is happening on every auth actions, such as sign up/in with provider or not. Any idea what could cause this and how I can fix it? Also happening from different domains. Could I have unwillingly messed up something in the database? |
OMG, it was not going away until I dropped the auth.email() function I created (copied from supabase/supabase#1857). Commands
|
Hey @nstrelow - is it possible you're modifying this function somehow? Or do you have any triggers on your tables which could be blocking the function from working correctly? |
Hmm it is still happening. Just now it failed with said error. After trying to login (via Gitlab) 5 times it worked. I still had the auth.email function, but was not using it. Will leave it deleted and see if it has to do with that function or if it's something else. |
This has now costed me a reject in the apple app store 😢 They said login is not working, but it was that error again. I still have this 1-2 times a day, where I need to logging around 5 times until it finally accepts my login Any idea? Something with the JTW token or so? |
Hi @nstrelow - I will reopen this, but we'll need more help to debug this with you. We aren't seeing this issue with other projects (as far as we can determine).
It's very hard to determine where the error is without a way to replicate the error on our side - I suspect it's a code issue (the dart SDK, your application code, schema changes) rather than an infra issue, but that's just a hunch since we aren't seeing the problem occur with other users. If we can narrow-down the problem landscape, we can dig a lot deeper. |
I migrated to a new database yesterday and hope that fixed it. If it reoccurs, I'll try some additional steps. I have a trigger function, which creates an entry inside a public.users schema, when a new user is created. That should be the only thing running, when I sign in. I just published the schema sql to Github under https://github.com/hpi-studyu/studyu (the cleaned one for the new database). Otherwise, a while ago, I accidentally restored a backup of Supabase back to Supabase using pgAdmin (and user @kiwicopple I really appreciate your help, but I would agree, that a single user having some problem is probably the users problem and not one of supabase. So please focus on the more generally helpful features and issues 😁 E.g. I am very interested in a complete and easy self hosted setup, since my app handles medical data and a lot of institutions want to self host. |
Hi @kiwicopple, @nstrelow - your issue could well be down to the trigger you have on the I've started seeing similar errors, initially it was the same as you - It's definitely the hook I have cloning users from the @kiwicopple any ideas on how to resolve? Should I / we be using a different user for running migrations? I guess it would be best to use the same user the dashboard uses, but I can't find the password for it anywhere. Cheers. |
Some further info on my issue: I've stripped my migration right back to the bare minimum to get my auth flow working, and generated a SQL script that I can run from the dashboard to rule out the This is the script I'm running:
However, it still doesn't work even running from the dashboard. I've narrowed it down to the audit trigger, as when I disable/remove it, I can register new users again. So my flow is: User arrives in If I disable the audit trigger to allow a user to sign up, then delete the corresponding cloned row from my |
Sorry @nstrelow, @kiwicopple, I've just found the logs section at the bottom of the authentication settings screen, and this has highlighted what my issue with the audit trigger outlined above is - I wasn't specifying the schema in which the audits table belonged. Somehow when the user is first cloned from However, this may help you diagnose your issue @nstrelow. Especially if you can get it to fail more reliably, you can check the logs here: https://app.supabase.io/project/{YOUR_APP}/auth/settings and you'll see a more details explanation of why the operation is failing. I'm not sure how long the logs are visible for though, so you may need to check pretty soon after a failure which may prove difficult if it's still only failing very infrequently for you. |
I have the same issue running locally with supabase cli. Let me know what I can do to provide sufficient information. My issue happens when I click a magic link, e.g. How to fix it
If I run |
Not sure what #4 means here (the 'sends so invites' part), but I was similarly able to resolve this issue by repeating steps 1-3 here and then running my own seed script for my local instance. |
@mclean25 just a typo so it's hard to read the sentence. But the step is running a seed script that sends invites (all invites are captured with the inbucket service) |
Hey all, transferring this to our Auth repo so we can best track this |
Hey everyone, these errors are usually returned when there is a failing trigger created on one of the tables in the auth schema. If anyone's still facing this issue and require assistance, please contact Supabase at our support link (https://app.supabase.com/support/new) |
Super old, but ran into this tonight. It was an issue with a trigger function having a misnamed param. To debug, start with a basic trigger like this and work back:
|
@saltcod yeah, this error is returned if you have a trigger on the auth schema that fails - it causes the entire transaction to be rolled back |
For me it was because i was hashing the password by myself first - then i inspected that supabase makes that for ya |
Happened to me when running my project locally and I had to manually remove all Docker Supabase volumes in addition to |
I have been very inconsistently getting a this error "Database error granting user" with a 500 HTTP status code.
Sometimes I try it a bit more and then it starts working again.
Has anyone had that before?
The text was updated successfully, but these errors were encountered: