Uploading Multiple Files to Supabase

Hi all,

I’m using the standard file upload component to allow users to select and load multiple files.

IF the user selects multiple files, the first file loads, but the other files get an error:

name: “Error”

stack: "Error: new row violates row-level security policy at Object.uploadFile

message: “new row violates row-level security policy”

cause

statusCode: “403”

error: “Unauthorized”

message: “new row violates row-level security policy”

Any ideas?

Hi Emeric :waving_hand:

It looks like this is caused by Supabase’s Row Level Security (RLS) blocking some of the file uploads, so only the first insert passes the policy and the others are rejected as unauthorized.

You should probably review your Supabase RLS policies for the related table/bucket to make sure they allow multiple inserts (one per file) under the same user/context, and that the conditions aren’t too restrictive for the additional files.

Let me know if you manage to figure it out!

Yes, my question was why would the second file would hit that issue? Haven’t sorted it out yet..

Can you share some screenshots from your RLS in supabase?

I tried a few versions. But this is the latest.