Error supabase.from() after reloage page
Project context
- React 19.1.1 + Vite 7.1.2 + TypeScript 5.8.3
- @supabase/supabase-js 2.57.2
- Tested in Chrome (latest stable)
Problem
After signing in with
However, after refreshing the page,
signInWithPassword
, queries using supabase.from(...).select(...)
work fine.However, after refreshing the page,
supabase.auth.getSession()
correctly returns the current session, but any subsequent query via the SDK hangs — the request never shows up in the Network tab.
What I tested
- I created a simple table (debug_test
) with RLS disabled and test rows.
- Via SDK (supabase.from('debug_test').select('*')
) → hangs after page reload.
- Via REST API with plain fetch
:
- Using anon key
in headers → returns 200 OK.
- Using access_token
from the recovered session → returns 200 OK.
- So PostgREST/Auth are working fine, but the SDK request never fires after reload.
Minimal reproduction
1. Create a simple table:
```sql
create table debug_test (
id uuid primary key default gen_random_uuid(),
note text
);
insert into debug_test (note) values ('row 1'), ('row 2');
alter table debug_test disable row level security;2 Replies
A total hang with no console.log even working after the call is almost always a sign of doing an async operation in onAuthStateChange handler.
See important note: https://supabase.com/docs/reference/javascript/auth-onauthstatechange
JavaScript: Listen to auth events | Supabase Docs
Supabase API reference for JavaScript: Listen to auth events