Creating a profile immediately after signup

I have some code so that when a user signs up, it creates a row on a profile table:

await supabase.auth.signUp({ email, password });
await supabase.from('profile').insert({username,email});


Unfortunately, when I add RLS:

CREATE POLICY "User can create own profile" ON public.profile FOR
INSERT WITH CHECK (auth.uid() = id);


The RLS stops the insert to the profile table. I figured this must be a relatively common pattern. Does anyone have any ideas?
Was this page helpful?