SupabaseS
Supabase4y ago
Wei

Storage Upload Upsert (SET)

I am trying to upload a file to avatars/<user_id> with RLS select public read for anons, insert and update for authenticated if
((bucket_id = 'avatars'::text) AND ((uid())::text = storage.filename(name)))

But update doesn't work. Upload works.
TS code for upload (create) only is
await supabase.storage
          .from('avatars')
          .upload(user.id, value.files[0]);

Update with upsert via upload method option returns
{
    "statusCode": "42501",
    "error": "",
    "message": "new row violates row-level security policy for table \"objects\""
}

And update with or without upsert returns 404
Thank you!
Was this page helpful?