© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
4 replies
allisonee

supabase.auth.getUser and supabase.auth.updateUser across simultaneous server sessions

I'm storing
provider_tokens
provider_tokens
inside the user metadata on supabase auth. My issue is that for 2 simultaneous requests that come in at time same time, if one request calls
await supabase.auth.updateUser
await supabase.auth.updateUser
, and the second request waits and then calls
const supabase = await createClient();
const { data: { user } } = await supabase.auth.getUser();
const supabase = await createClient();
const { data: { user } } = await supabase.auth.getUser();

The user from the second request, does not get the update from the 1st request.

Subsequent server calls seem to get the updated user--so it's really requests that started before the
updateUser
updateUser
.

example:
Server process 1 (provider_token is
bar
bar
)
        const { error: updateError } = await supabase.auth.updateUser({
          data: {
            provider_token: foo,
          },
        });
        const { error: updateError } = await supabase.auth.updateUser({
          data: {
            provider_token: foo,
          },
        });

Second server process, that started the same time as server process 1, but waited for half a second for updateUser to get called
const supabase = await createClient();
const { data: { user } } = await supabase.auth.getUser();  // This getUser is still bar, not 
const supabase = await createClient();
const { data: { user } } = await supabase.auth.getUser();  // This getUser is still bar, not 

How can I get the second server process to get the correct user metadata form process 1's
updateUser
updateUser
?
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

supabase auth.getUser always returns null
SupabaseSSupabase / help-and-questions
4y ago
Rate limiting on supabase.auth.getUser(token)
SupabaseSSupabase / help-and-questions
4w ago
20 second call to supabase.auth.getUser()
SupabaseSSupabase / help-and-questions
13mo ago
auth.updateUser not working
SupabaseSSupabase / help-and-questions
13mo ago