Menu

Supabase Storage upload fails with "new row violates row-level security policy"? Here's the fix
📰

Supabase Storage upload fails with "new row violates row-level security policy"? Here's the fix

DEV Community: postgres·Ahmed Hassan Yaseen·14 days ago
#j9XopgzC
#devtopostgresql#devto#dev#upload#policy
Reading 0:00
15s threshold

Your app tries to upload a file to Supabase Storage, and the request fails with one of these:

new row violates row-level security policy StorageApiError: new row violates row-level security policy Unauthorized

Enter fullscreen mode

Exit fullscreen mode

Supabase Storage refuses every upload until the storage.objects table has policies that allow it. The fix: add an INSERT policy for the bucket, scoped to the user's own folder, and add SELECT and UPDATE policies if the app overwrites files with upsert .

I see this one a lot in apps built with Lovable and Bolt on Supabase, usually the first time someone adds an avatar or document upload.

Why it happens

No policy on storage.objects . Supabase's docs say it plainly: "By default Storage does not allow any uploads to buckets without RLS policies." A new bucket starts closed.

Upsert needs more than INSERT. Overwriting an existing file ( upsert: true ) also needs SELECT and UPDATE policies.

The path doesn't match the policy.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.