https://supabase.com/ logo
Is there a good way to debug RLS policies? I have ...
# help
g
Is there a good way to debug RLS policies? I have a very simple RLS policy on a
profiles
table (which I believe I lifted straight from the Supabase docs) that is preventing me from inserting into the table and I have no idea why. The
profiles
table has an
id
column for the primary key and the policy is below:
Copy code
create policy "Users can insert their own profile."
  on profiles for insert
  with check ( auth.uid() = id );
When I run
this.#supabase.from('profiles').insert()
as an authenticated user I get
new row violates row-level security policy for table \"profiles\"
.
n
Hello @gesusc! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
g
I am inserting a new row with the
id
set to the authenticated users id.
g
You also need select policy for insert: https://supabase.com/docs/reference/javascript/insert#notes
g
Ahh ok
Thanks
2 Views