When a user signs up, I want to create a corresponding profile for them in a separate (public) table. I’m running into two issues, first it seems like the user object isn’t being returned. That’s preventing me from creating the profile with the same uuid as the auth table.
Any advice getting past this? Seems really simple but I haven’t found a solution.
Best advice is to do this on supabase side.
If I remember correctly they have a template or an example of exactly this usecase.
This is what i have i my personal project
You need to create a function handle_new_user (Database > Functions)
This is what mine is looking like
begin
insert into public.profiles (id)
values (new.id);
return new;
end;
That’s exactly what I do.
Trigger after insert into auth.users > execute function
Be careful when setting all this, you have to dive into the advanced settings to allow your function to do it’s business. Security Definer is the option you should look for.