© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•7mo ago•
21 replies
CuriousLama

Supabase Storage file upload - 403 Unauthorized

Hello everyone.
I've been trying to upload files into bucket (my backend express+nodejs) but getting 403 unauthorized constantly, despite RLS are created for INSERT, UPDATE, DELETE for authorized users.
const filePath =
images/${product.sku}/${Date.now()}_${fileName}
images/${product.sku}/${Date.now()}_${fileName}
;
const { data, error } = await supabase.storage.from('products').upload(filePath, file.buffer, {
upsert: true,
contentType: file.mimetype || 'application/octet-stream',
});
I want files sorted by folders. As folder name I want to use product sku (0001, 0002, 0003, etc.) which will be nested folders of the root folder (images). I have feeling that RLS don't work for nested folders in a bucket.

My RLS policies:
-- For INSERT operations (uploading files)
CREATE POLICY "Enable insert for authenticated users" ON storage.objects FOR INSERT
TO authenticated
WITH CHECK (bucket_id = 'products' AND auth.role() = 'authenticated');

-- For SELECT operations (reading/downloading files)
CREATE POLICY "Enable read access for all users" ON storage.objects FOR SELECT
USING (bucket_id = 'products' and name like 'public/%');

-- For UPDATE operations
CREATE POLICY "Enable update for authenticated users" ON storage.objects FOR UPDATE
USING (bucket_id = 'products' AND auth.role() = 'authenticated')
WITH CHECK (bucket_id = 'products' AND auth.role() = 'authenticated');

-- For DELETE operations
CREATE POLICY "Enable delete for authenticated users" ON storage.objects FOR DELETE
USING (bucket_id = 'products' AND auth.role() = 'authenticated');

What am I doing wrong? It's so frustrating. Bucket set as public.
I will be appreciated for any help or advice.
Thanks
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

supabase storage upload issue
SupabaseSSupabase / help-and-questions
4mo ago
upload filelist supabase storage
SupabaseSSupabase / help-and-questions
4y ago
Upload File from Android app to Supabase Storage
SupabaseSSupabase / help-and-questions
3mo ago
Supabase storage upload not working
SupabaseSSupabase / help-and-questions
9mo ago