Skip to content

Getting message: "new row violates row-level security policy for table \"objects\"" statusCode: "42501" #3389

Answered by za01br
za01br asked this question in Questions
Discussion options

You must be logged in to vote

Well, I'm probably the only one that took forever to understand this, but:

  • Even if the bucket is "public", you still need to set up policies
  • In a case where people should be able to VIEW and UPLOAD files to a bucket, you need to:
  1. Go to SQL
  2. + New Query
  3. Use this query and hit "Run
create policy "Public Access Bucket Images Get"
on storage.objects for select
using ( bucket_id = 'YOUR-BUCKET-NAME' );

create policy "Public Access Bucket Images Post"
on storage.objects for insert
with check ( bucket_id = 'YOUR-BUCKET-NAME' );

All good now! 🤙🏻

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@Aminigbo
Comment options

@jstdk
Comment options

Answer selected by za01br
Comment options

You must be logged in to vote
1 reply
@aman246149
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants