Supabase · sdk · fg-0202

Supabase queries hang forever after awaiting a Supabase call inside onAuthStateChange

If you see The next supabase.from(...) or getSession() anywhere in the app never resolves, with no error, the cause and the fix for Supabase are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
The next supabase.from(...) or getSession() anywhere in the app never resolves, with no errorAcquiring an exclusive Navigator LockManager lock immediately failedHang shows up only after login, a tab refocus, or a token refresh
Cause
Older auth clients held a session lock while running onAuthStateChange callbacks, so awaiting another Supabase call inside the callback waited on the same lock. Version 2.107.0 removed the navigator.locks mutex.
Fix
Upgrade to supabase-js 2.107.0 or later. On older versions keep the callback synchronous and defer any Supabase call with setTimeout. Even on new versions, never call refreshSession from a TOKEN_REFRESHED handler.
Apply
supabase.auth.onAuthStateChange((event, session) => { setSession(session); // sync only setTimeout(async () => { await supabase.from('profiles').select('*').eq('id', session?.user.id); }, 0); }); npm install @supabase/supabase-js@^2.107.0
Affected
@supabase/supabase-js 2.x before 2.107.0 (released 2026-06-02); gotrue-js 2.62.0 and later in that range
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun