SupabaseS
Supabase4y ago
Leo

Can't upload to storage anymore

I've had a public 'avatars' bucket for months now, but all of a sudden I'm getting:

error: {
    statusCode: '401',
    error: 'Invalid JWT',
    message: 'new row violates row-level security policy for table "objects"'
  }


when trying to upload files.

I've added RLS:

bucket_id = 'avatars' AND storage."extension"(name) = 'jpg' AND storage."extension"(name) = 'png' AND LOWER((storage.foldername(name))[1]) = 'public' AND auth.role() = 'anon'


But upload is still failing with:

  const {error, data} = await supabase.storage.from("avatars").upload(`twitter-990977436916551680.jpg`, buffer, {
    upsert: true,
  });


did something change? How can I allow my API to upload files to storage again?
Was this page helpful?