© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
4 replies
Actual Left Shark

how to create storage RLS policies

I am trying to create a storage bucket - where I am allowing users to upload profile pictures. This is the RLS policy I am trying to implement, but its not working. Attached is my RLS policy and the storage bucket layout.

Here is the upload function (javascript) as well as the output

filePathexample: public/{User UID}/{random UID}.jpeg
filePathexample: public/{User UID}/{random UID}.jpeg

const { data: uploadData, error: uploadError } = await supabase.storage
        .from("avatars") 
        .upload(filePath, avatar, {
          cacheControl: "3600",
          upsert: true
        });
const { data: uploadData, error: uploadError } = await supabase.storage
        .from("avatars") 
        .upload(filePath, avatar, {
          cacheControl: "3600",
          upsert: true
        });


My goal is to only let users upload/edit/delete their own profile images. Any suggestions on what I am doing wrong? The error I keep getting is
Upload error: {
  statusCode: '403',
  error: 'Unauthorized',
  message: 'new row violates row-level security policy'
}
Upload error: {
  statusCode: '403',
  error: 'Unauthorized',
  message: 'new row violates row-level security policy'
}
Screenshot_2025-01-26_at_10.43.14_PM.png
Screenshot_2025-01-26_at_10.44.38_PM.png
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 policies
SupabaseSSupabase / help-and-questions
13mo ago
Multiple RLS Policies
SupabaseSSupabase / help-and-questions
4y ago
Testing RLS policies
SupabaseSSupabase / help-and-questions
4y ago
Supabase - RLS Policies Issues
SupabaseSSupabase / help-and-questions
13mo ago