© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•14mo ago•
39 replies
Geo⭐

Storage RLS not working when querying a table in public

Hello,

I've setup successfully RLS on my tables, but when I try to configure it on my buckets, it doesnt work.

I have a table named roles where i store users' auth id (column user_id), and the team_id.

If I bullt the RLS policy hardcoding the team_id it works, like this example

((bucket_id = 'media') AND ('00001' = (storage.foldername(name))[1]))

but when i try to retrieve the team_id from the roles table, it fails:

bucket_id = 'media' AND
EXISTS (
SELECT 1
FROM roles
WHERE user_id = auth.uid()
AND team_id = (storage.foldername(name))[1]
)

FYI: my supabase instance its self-hosted in docker

Thanks you in advance and happy holidays 😄
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

Storage RLS Template not working
SupabaseSSupabase / help-and-questions
13mo ago
RLS not working on my roles table
SupabaseSSupabase / help-and-questions
4y ago
#help Table public.companies is public, but RLS has not been enabled.
SupabaseSSupabase / help-and-questions
2mo ago
RLS policy 'in' not working
SupabaseSSupabase / help-and-questions
4y ago