Cursor·Fix

Fix: Supabase Storage Upload Returns Error

Quick Answer

Check your storage bucket policies in Supabase Dashboard > Storage > Policies. The most common issue is missing an INSERT policy on the storage.objects table for authenticated users.

Quick Fix Summary

IssueFile upload failing
Fastest fixCreate storage bucket policies
Use this page ifError: new row violates row-level security policy for storage.objects

Symptoms

  • !Error: new row violates row-level security policy for storage.objects
  • !Upload returns 403 Forbidden
  • !File uploads work locally but fail in production
  • !Large files fail but small files work

Step-by-Step Fix

1

Create storage bucket policies

Go to Supabase Dashboard > Storage > your bucket > Policies. Add policies for INSERT (upload), SELECT (download), DELETE. Example INSERT policy: (auth.uid() IS NOT NULL) for authenticated uploads.

2

Check file size limits

Free tier allows files up to 50MB. Check your bucket's file size limit in Storage > Configuration. For larger files, upgrade your plan or use multipart upload.

3

Verify MIME types

If you restricted allowed MIME types on the bucket, ensure the uploaded file type is in the list. Common mistake: allowing 'image/jpeg' but not 'image/jpg'.

4

Use the correct upload method

Use supabase.storage.from('bucket-name').upload('path/file.jpg', file, { contentType: file.type }). Always include contentType to prevent MIME type errors.

Frequently Asked Questions

Local development often bypasses RLS. In production, you need explicit storage policies. Check the Policies tab on your storage bucket.

Free plan: 50MB per file, 1GB total storage. Pro plan: 5GB per file, 100GB total storage.

Related

Weekly Signals

Get the next fix, switch, or warning before it hits your build.

Join builders getting the community signals, fix patterns, and tool shifts that matter before they show up everywhere else.

Follow the signals →