© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
1 reply
Loomer

Storage RLS Template not working

Hi,

i used the RLS Template to restrict insert only to a subfolder in my storage bucket:

CREATE POLICY "policy_name"
ON storage.objects FOR {operation} {USING | WITH CHECK} (
    -- restrict bucket
    bucket_id = {bucket_name}
    and auth.uid()::text = (storage.foldername(name))[1]
);
CREATE POLICY "policy_name"
ON storage.objects FOR {operation} {USING | WITH CHECK} (
    -- restrict bucket
    bucket_id = {bucket_name}
    and auth.uid()::text = (storage.foldername(name))[1]
);


still i can upload files

const folderPath = `test/${pdfFilename}`;
            const { data, error } = await supabase.storage
                .from("invoices")
                .upload(folderPath, blob, {
                    contentType: "application/pdf",
                    upsert: true,
                });
const folderPath = `test/${pdfFilename}`;
            const { data, error } = await supabase.storage
                .from("invoices")
                .upload(folderPath, blob, {
                    contentType: "application/pdf",
                    upsert: true,
                });


into the "test" folder for my understanding it should not work
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

RLS not working
SupabaseSSupabase / help-and-questions
3mo ago
Storage RLS Help
SupabaseSSupabase / help-and-questions
4mo ago
Storage RLS Performance Index not used with RLS enabled
SupabaseSSupabase / help-and-questions
4y ago
Storage RLS not working when querying a table in public
SupabaseSSupabase / help-and-questions
14mo ago