Open kmiguel10 opened 1 year ago
I had the same problem using the GUI but I was using the code snippets to create the function and the trigger. These seemed to work but then when I would log in on the app, I would get back a session but supabase would fail to save the user to the auth table. If I deleted the trigger using the query drop trigger <TRIGGER NAME> on auth.users;
then supabase would save the user to auth.users but, of course, nothing would be in the profiles table.
I ended up deleting the profiles table, function, trigger and the modifying the User Management Starter template to work with this tutorial. You can see the templates in the SQL editor. Basically, just modify the values to match the values we want in the profiles table. Edit the values in the part for creating the profiles table and the arguments for the public.handle_new_user function. Run it then don't forget to re add the foreign key relation between the tweets table user_id and the profiles table with cascade on delete.
@kmiguel10 you can find the solution for that in this video.
Basically, all you have to do is run this in the SQL editor, changing it to your own information.
create trigger trigger_name after insert on auth.users for each row execute function function_name();
drop trigger if exists trigger_name on auth.users;
This is the command that I used, it works for me as of June 5 2024.
CREATE TRIGGER users_insert_trigger AFTER INSERT ON auth.users FOR EACH ROW EXECUTE FUNCTION insert_profile_for_new_user();
I am stuck in chapter 12 because when creating a trigger to watch for a changes in the users table in auth schema , the dropdown for the Table (to watch for) options only shows my 2 public tables which are profiles and tweets but it should show the users table.
From tutorial:
Issue:
Thanks!