- Symptom
- StorageApiError: new row violates row-level security policy (403)INSERT policy on storage.objects matches the bucket and auth.uid()upsert: true uploads fail even when first uploads work
- Cause
- The Storage API inserts the object row and reads it back in the same statement, so a missing SELECT policy fails the whole upload. Overwrites with upsert also need an UPDATE policy.
- Fix
- Add SELECT (and UPDATE if you overwrite) policies on storage.objects that mirror the INSERT policy's bucket and path checks.
- Apply
create policy "read own files" on storage.objects for select to authenticated using (bucket_id = 'avatars' and (storage.foldername(name))[1] = (select auth.uid())::text); create policy "update own files" on storage.objects for update to authenticated using (bucket_id = 'avatars' and (storage.foldername(name))[1] = (select auth.uid())::text);- Affected
- Supabase Storage on all plans with RLS on storage.objects
- Sources
Last verified 2026-10-15 · Confirmed by 0 builders