© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
19 replies
TomCarnay

Trouble getting RLS working

Hi I am trying to use RLS for the first time. After users authenticate (using google) for the first time, they enter username, interests, and newsletter and privacy opt-ins.

I have the following RLS policy (taken from the templates):

CREATE POLICY "Enable insert for authenticated users only" ON public.profiles
AS PERMISSIVE FOR INSERT
TO authenticated

WITH CHECK (true)

My insert statement js looks like this:

const { data, error } = await supabase
.from('profiles')
.insert([{ id: user.id, username: userParams.username, created_at: new Date(),
locations: userParams.locations, newsletter: userParams.newsletter, privacy: userParams.privacy}])

if (error) {
console.log(error)
}

but I'm getting following error in the console:
code: '42501', details: null, hint: null, message: 'new row violates row-level security policy for table "profiles"'

I don't understand what is going on, as I'm definitely authenticated when trying to insert - am logging the user in the console and it shows as authenticated, with the user_id etc..
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

RLS not working
SupabaseSSupabase / help-and-questions
3mo ago
Bucket upload getting RLS error
SupabaseSSupabase / help-and-questions
6mo ago
Storage RLS Template not working
SupabaseSSupabase / help-and-questions
13mo ago
RLS policy 'in' not working
SupabaseSSupabase / help-and-questions
4y ago