© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
23 replies
Forsect

Can't use auth.uid() inside functions

Hey guys, I can promise you I could used
auth.uid()
auth.uid()
and
auth.email()
auth.email()
inside my PostgreSQL functions like over a week ago. That's how I wrote my
delete_user
delete_user
which I use with
.rpc()
.rpc()
from code:
begin
raise log 'auth.uid(): %', auth.uid();
delete from auth.users where id = auth.uid();
end;
begin
raise log 'auth.uid(): %', auth.uid();
delete from auth.users where id = auth.uid();
end;

But now I noticed I can't delete my users anymore and I can see from logs the reason is that
auth.uid()
auth.uid()
returns me
<NULL>
<NULL>
. It doesn't matter whether I do
SECURITY DEFINER
SECURITY DEFINER
or
SECURITY INVOKER
SECURITY INVOKER
for my func.
auth.email()
auth.email()
doesn't work as well.
Did something happen over this week?
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

Get auth.uid() in triggered functions?
SupabaseSSupabase / help-and-questions
4y ago
Supabase RPC: auth.uid() context across nested functions?
SupabaseSSupabase / help-and-questions
4mo ago
auth.uid() question
SupabaseSSupabase / help-and-questions
8mo ago
RLS and auth.uid()
SupabaseSSupabase / help-and-questions
4y ago