getSession hangs [javascript client library]

Issue Summary for Supabase Title: getSession() and refreshSession() hang indefinitely even with lock: noOpLock workaround Environment: @supabase/supabase-js (check your version in package.json) Browser: Chrome (likely others too) Next.js app Problem: After a JWT token refresh occurs, subsequent calls to supabase.auth.getSession() and supabase.auth.refreshSession() hang indefinitely and never resolve. Symptoms: onAuthStateChange fires TOKEN_REFRESHED successfully Immediately after, any call to getSession() or refreshSession() hangs forever Applied the lock: noOpLock workaround from #1594 - did not help App becomes unusable - all authenticated API requests fail Reproduction: User is logged in, JWT expires (5 min expiry for testing) Auto-refresh triggers, TOKEN_REFRESHED event fires User clicks a button that triggers an API request Request interceptor calls getSession() to get current token getSession() never resolves (hangs) Expected: getSession() should return immediately with the session from localStorage/memory. Actual: getSession() hangs indefinitely, even with Web Locks disabled via lock: noOpLock. Workaround needed: Reading token directly from localStorage (sb-{project}-auth-token) bypasses the issue, but this shouldn't be necessary. Reference: Related to #1594 but the noOpLock workaround doesn't fully resolve it.
2 Replies
garyaustin
garyaustin4d ago
Make sure you check the important note here: https://supabase.com/docs/reference/javascript/auth-onauthstatechange This is the most common reason for another Supabase call to hang around the time of an auth event.
JavaScript: Listen to auth events | Supabase Docs
Supabase API reference for JavaScript: Listen to auth events
barlazy
barlazyOP4d ago
perf! seems to work Thank you

Did you find this page helpful?