© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
3 replies
Deleted User

supabase calling supabase.auth.user().id crashes server error 500

in api.js where connection to supabase is made
userDetails() {
  return supabase
  .from('muni_users')
  .select('*')
  .eq('user_id', supabase.auth.user().id);
},
userDetails() {
  return supabase
  .from('muni_users')
  .select('*')
  .eq('user_id', supabase.auth.user().id);
},


on a page
export async function load() {
  const { data: muni_user, error: bleh } = await db.users.userDetails();
  console.log(muni_user)
};
export async function load() {
  const { data: muni_user, error: bleh } = await db.users.userDetails();
  console.log(muni_user)
};


and this is error I get in terminal while my browser shows ERROR 500
Cannot read properties of null (reading 'id')
TypeError: Cannot read properties of null (reading 'id')
Cannot read properties of null (reading 'id')
TypeError: Cannot read properties of null (reading 'id')


What is causing it and how can I pass currently logged in user id to userDetails()? If I hardcode user id which is uuid for that table then it shows me results I am looking for.
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

Cannot Create User – Supabase Auth Returns 500 Internal Server Error
SupabaseSSupabase / help-and-questions
7mo ago
auth v1 user 500 Internal Server Error
SupabaseSSupabase / help-and-questions
4y ago
Supabase Website - Error 500 - Internal Server Error
SupabaseSSupabase / help-and-questions
4y ago
500 (Internal Server Error) w/ Auth
SupabaseSSupabase / help-and-questions
3y ago