RLS Policy not working (err 42501) #7251
barrelltech
started this conversation in
General
Replies: 1 comment
-
You may not have a user signed in when you make the call. A quick check would be to set RLS to work for anon and see if insert works. If so then you are not passing the user token at the time you do the insert call. Set "Target roles" to anon and policy to true for the test. Note: not sure why the UI displays it as uid() instead of auth.uid(), but that is not an issue with the code running correctly. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello -
I'm trying to implement a basic RLS policy that will only allow a user to interact with records they own.
I've gone through the following steps:
I've confirmed that the data is being set with an
owner-uuid
propertyI've tried invoking the
insert
method with the optionsreturning: "minimal"
(although the select call should be valid)I still get the error
42501
.--
I've tried every combination of RLS policies I can think of, explicitly setting the tables, fudging with the data, changing the field name to no include special characters, everything. Nothing seems to be working.
I feel like this should be relatively basic functionality. What am I missing?
PS: Supabase automatically reformats the comparison function after submitting it - I've tried changing it back to auth.uid but it always reverts.
Beta Was this translation helpful? Give feedback.
All reactions