Replies: 1 comment 2 replies
|
You are probably not pulling the data correctly from the auth.users row provided to the trigger function, the data does not exist in the inserted row, or you have a mismatch in data types to the table you are inserting too. You might be able to see the reason in the dashboard database tab, then use the Postgres log right after you attempt your signup. You can also look in the auth.users table in the dashboard table UI (select auth schema) and see what columns and data is available to use in the trigger function. You could also show your function and someone might be able to point out your syntax error or help further with the issue. |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I set up a "login with GitHub" authentication method with Supabase which works, but I need to have the users on a public profile table. I followed some instructions:
https://daily-dev-tips.com/posts/supabase-automatically-create-user-profiles-on-sign-up/
#563
When I followed the steps @kiwicopple provided, it worked but that was just for the id and email...when I tried to add my own additional information (id, email, display name and avatar URL) for the data I needed, it didn't work and I got this error
database error saving new userI also saw in the discussions that the table should only be created with SQL and not the GUI which I did but it still didn't work...
Here is my code 👇🏽
create function public.handle_new_user() returns trigger language plpgsql security definer set search_path = public as $$ begin insert into public.users (id, email, username, avatar_url, display_name) values (new.id, new.raw_user_meta_data ->> 'user_name', new.raw_user_meta_data ->> 'email', new.raw_user_meta_data ->> 'avatar_url', new.raw_user_meta_data.name); return new; end; $$;Help!
All reactions