Hi, I’m working on a Next.js 14 project hosted on Vercel, using Supabase for authentication.
Despite implementing a singleton Supabase client using globalThis
, I keep getting this warning:
Multiple GoTrueClient instances detected in the same browser context.
It is not an error, but this should be avoided as it may produce undefined behavior…
What I’ve already done:
- Supabase client is imported only from
lib/supabase/client.ts
(singleton viaglobalThis
) - No instantiations inside components or hooks
- Server-side uses
lib/supabase/server.ts
(with cookies andcreateServerClient
) - I cleared browser cache, localStorage, tested all flows (login, register, etc.)
- Still happens on both v0.dev and Vercel preview deployment
The warning often appears during login/register or after page refreshes.
My questions:
- Is this warning just a false positive in dev?
- Is React Fast Refresh or Vercel’s SSR causing multiple Supabase auth calls?
- Has anyone solved this cleanly in a Vercel + Supabase + Next.js 14 stack?
Thanks!