© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
66 replies
jopfre

accessing values set in app_metadata security definer

Following the managing user data guide https://supabase.com/docs/guides/auth/managing-user-data I have got users profiles created when a user signs up.

However I am also storing a user role within the app_metadata object.

When I try and access this value within the security definer using
new.raw_app_meta_data->'role'
new.raw_app_meta_data->'role'
I get null.

If I
raise log '%', new.raw_app_meta_data;
raise log '%', new.raw_app_meta_data;
I get
{"provider": "email", "providers": ["email"]}
{"provider": "email", "providers": ["email"]}
.

Whereas in auth.users.raw_app_meta_data I can see
{"role":"admin","provider":"email","providers":["email"]}
{"role":"admin","provider":"email","providers":["email"]}
.

Why is my role not available within the
new
new
object?
Supabase Documentation
Managing User Data
Securing your user data with Row Level Security.
Managing User Data
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
Next page

Similar Threads

RLS + Security definer ?
SupabaseSSupabase / help-and-questions
4mo ago
Security Definer Functions - Custom Roles
SupabaseSSupabase / help-and-questions
13mo ago
RLS 403 on Storage Upload despite valid subquery/SECURITY DEFINER
SupabaseSSupabase / help-and-questions
4w ago
Who's uuid is used when doing auth.uid() in a security definer function?
SupabaseSSupabase / help-and-questions
4y ago