Supabase Storage upload fails: new row violates row-level security policy

Image/file upload to Supabase Storage fails with an RLS error? Add policies on storage.objects for INSERT (plus SELECT/UPDATE for upsert).

Last edited October 17, 2026

On this page

What it means in plain English

Supabase Storage keeps file records in a table called storage.objects, protected by its own security rules. Without a rule allowing uploads, every upload is refused.

Supabase Launch Safety Pack

RLS checklist, policy templates, key migration and environment variable setup.

See what’s inside

Secure checkout by Stripe

One-time payment through Stripe. Priced in USD. Local taxes such as UK VAT may be added at checkout.

Likely causes

  • No INSERT policy on storage.objects for your bucket.
  • Using upsert: true without SELECT and UPDATE policies too.
  • User not signed in.

How to fix it, step by step

  1. Supabase → Storage → Policies → your bucket → New policy.
  2. Allow signed-in users to upload, e.g. only into their own folder:
create policy "Users upload to own folder"
on storage.objects for insert to authenticated
with check ( bucket_id = 'avatars' and (storage.foldername(name))[1] = (select auth.jwt()->>'sub') );
  1. If you overwrite files (upsert), also add SELECT and UPDATE policies.
  2. For public images, mark the bucket public or add a SELECT policy.

How to check it worked

  • Upload a file from the live site; it appears in the bucket.
  • Signed-out upload is refused.

If the file is in the bucket and the image on the page is still broken, the bucket is private or the URL is the public form. See Supabase Storage images not loading.

Sources

Tool to consider: Supabase.

Supabase Launch Safety Pack

RLS checklist, policy templates, key migration and environment variable setup.

See what’s inside

Secure checkout by Stripe

One-time payment through Stripe. Priced in USD. Local taxes such as UK VAT may be added at checkout.