Skip to content

supabase.auth.setSession and supabase.auth.updateUser do not resolve unless there is an error #1441

Open
@elitenas

Description

@elitenas

Summary
When using the Supabase client in an async function, both supabase.auth.setSession and supabase.auth.updateUser fail to resolve or return unless an error occurs. This blocks further execution in the code despite successful authentication or updates.

// Scenario 1: setSession
const { data, error } = await supabase.auth.setSession({
  access_token,
  refresh_token,
});
console.log('Setting session with token:', data, error); // Only logs if error occurs
console.log(data?.user); // Never reached if no error
// Scenario 2: updateUser
const { error: updateError } = await supabase.auth.updateUser({
  password: newPassword,
});
console.log('Update password error:', updateError); // Not called unless there's an error

Expected Behavior
Both methods should resolve regardless of whether there is an error, returning the appropriate data or null. Logging should be possible after the calls, and the behavior should be consistent with other auth methods like getSession.

Actual Behavior
setSession and updateUser appear to hang or do not return unless there's an error.

Causes the rest of the async function to not proceed, giving the illusion of being stuck.

Environment
Supabase JS SDK version: @supabase/supabase-js@2.9.9

Runtime: React Native / Expo (also affects Web SDK)

Additional Context
This issue is critical in flows like password recovery and token-based login where setSession or updateUser are required. It breaks user flows and leads to confusion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions