1

Sometimes I can upload a file and sometimes I get this error:

{statusCode: '403', error: '', message: 'new row violates row-level security policy (USING expression) for table "objects"'}

I got the uploading code from this page. I duplicated the component with different bucket names and only changed htmlFor, id, accept and bucket url, both with the same policies but sometimes the other works/fails or both. One is for image upload and the other video, both have worked at some point so idk why I keep getting the error. And none of the files exceeds the max upload size(50mb). Heres SQL snippet I used:

insert into storage.buckets (id, name)
  values ('avatars', 'avatars');

create policy "Avatar images are publicly accessible." on storage.objects
  for select using (bucket_id = 'avatars');

create policy "Anyone can upload an avatar." on storage.objects
  for insert with check (bucket_id = 'avatars');

Also I'm using Typescript and no error in my code.

Mintee
  • 505
  • 4
  • 22

0 Answers0