Hello guys I need help: Note that without RLS eve...
# supabase-kt
m
Hello guys I need help: Note that without RLS everything works fine. Also I use Auth to sign in by email or by google. Error: new row violates row-level security policy for table "notes" Code: 42501 Hint: null Details: null URL: https://xxxxxx.supabase.co/rest/v1/notes?columns=title%2Ccontent&amp;select=%2A Headers: [Authorization=[Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6IlFmdnVsMkl.... Koin: single<SupabaseClient> { createSupabaseClient( supabaseUrl = "https://xxxxx.supabase.co", supabaseKey = "sb_publishable_xxxxxx" ) { install(Postgrest) install(Auth) { alwaysAutoRefresh = true autoSaveToStorage = true autoLoadFromStorage = true } } } Insert: supabaseClient.postgrest["notes"].insert( mapOf( "title" to title, "content" to content ) select() single() }.decodeAsOrNull() catch (e: Exception) { e.printStackTrace() Log.e("SupabaseDBManager", "Error inserting note $ {e.localizedMessage}") null } schema: create table public.notes ( id uuid not null default gen_random_uuid (), created_at timestamp with time zone not null default now(), title text not null default ''::text, content text not null default ''::text, user_id uuid not null default auth.uid (), constraint notes_pkey primary key (id), constraint notes_user_id_fkey foreign KEY (user_id) references auth.users (id) on update CASCADE on delete CASCADE ) TABLESPACE pg_default;
h
From your screenshot, seems it is caused by the
as RESTRICTIVE
. Consider using
PERMISSIVE
to enable the operators for authenticated users. For example:
Screenshot 2025-11-04 at 16.45.28.png
m
Noted