Bug report
Describe the bug
When using the Supabase server client (from @supabase/ssr) to call signIn or signOut inside a Next.js server action, the auth state changes are not detected on the browser client (createBrowserClient()).
Specifically, onAuthStateChange() on the browser client does not fire when the sign-in or sign-out is done from a server action.
This leads to an inconsistent auth state in the frontend after using server-side auth methods.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Set up Supabase in a Next.js app using both
createServerClient() and createBrowserClient()
- Set up
onAuthStateChange() in a layout or component using the browser client.
- Trigger
signIn() or signOut() using a server action via the server client.
- Notice that the browser does not detect any change in auth state.
Expected behavior
Calling signIn() or signOut() on the server should also update the browser-side auth state or trigger onAuthStateChange() accordingly, assuming the cookies are properly shared.
Screenshots
If applicable, add screenshots to help explain your problem.
System information
- OS: [e.g. macOS, Windows]
- Browser (if applies) [e.g. chrome, safari]
- Version of supabase-js: [e.g. 6.0.2]
- Version of Node.js: [e.g. 10.10.0]
Additional context
This behavior breaks real-time auth-dependent UI updates and makes sign-in/sign-out UX inconsistent.
Bug report
Describe the bug
When using the Supabase server client (from
@supabase/ssr) to callsignInorsignOutinside a Next.jsserver action, the auth state changes are not detected on the browser client (createBrowserClient()).Specifically,
onAuthStateChange()on the browser client does not fire when the sign-in or sign-out is done from a server action.This leads to an inconsistent auth state in the frontend after using server-side auth methods.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
createServerClient()andcreateBrowserClient()onAuthStateChange()in a layout or component using the browser client.signIn()orsignOut()using a server action via the server client.Expected behavior
Calling
signIn()orsignOut()on the server should also update the browser-side auth state or triggeronAuthStateChange()accordingly, assuming the cookies are properly shared.Screenshots
If applicable, add screenshots to help explain your problem.
System information
Additional context
This behavior breaks real-time auth-dependent UI updates and makes sign-in/sign-out UX inconsistent.