© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
2 replies
Floppy Disk

Bucket RLS works for Insert but not Update

I have following code in my server function
const { data, error } = await supabase.storage.from('user_avatar').update(`${id}/avatar.${avatar.name.split('.').pop()}`, avatar,{
        upsert: true,
    });
const { data, error } = await supabase.storage.from('user_avatar').update(`${id}/avatar.${avatar.name.split('.').pop()}`, avatar,{
        upsert: true,
    });

and it throws me
Error: new row violates row-level security policy
Error: new row violates row-level security policy
when I try to update user avatar but not on initial upload.
My RLS for insert and update on the bucket are the same:
((bucket_id = 'user_avatar'::text) AND (( SELECT (auth.uid())::text AS uid) = (storage.foldername(name))[1]))
((bucket_id = 'user_avatar'::text) AND (( SELECT (auth.uid())::text AS uid) = (storage.foldername(name))[1]))
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

My RLS works for select but does not work for delete
SupabaseSSupabase / help-and-questions
13mo ago
RLS for bucket joined with table data
SupabaseSSupabase / help-and-questions
5mo ago
Bucket upload getting RLS error
SupabaseSSupabase / help-and-questions
6mo ago
RLS - Help with Insert Policy
SupabaseSSupabase / help-and-questions
4y ago