You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug Report: TypeError: Cannot read properties of null (reading 'useState') with @supabase/auth-ui-react
Describe the bug:
When using the @supabase/auth-ui-react library in a Next.js 15.2.3 application, I encounter a TypeError: Cannot read properties of null (reading 'useState') error on the client-side when rendering the AuthComponent. This error prevents the authentication UI from displaying correctly.
To Reproduce:
Create a new Next.js 15.2.3 project.
Install the following dependencies:
npm install @supabase/auth-ui-react @supabase/auth-ui-shared @supabase/supabase-js react react-dom next
Create a basic Supabase client setup.
Create an /auth page with the following code:
importdynamicfrom'next/dynamic';import{useRouter}from'next/router';import{useEffect,useState}from'react';import{supabase}from'../lib/supabaseClient';// Replace with your Supabase client setupimport{ThemeSupa}from'@supabase/auth-ui-shared';constAuthComponent=dynamic(()=>import('@supabase/auth-ui-react').then((mod)=>mod.Auth),{ssr: false,});exportdefaultfunctionAuthPage(){constrouter=useRouter();const[isMounted,setIsMounted]=useState(false);useEffect(()=>{setIsMounted(true);},[]);useEffect(()=>{const{data: authListener}=supabase.auth.onAuthStateChange((event,session)=>{if(session){router.push('/dashboard');}});return()=>{authListener.subscription.unsubscribe();};},[router]);return(<divclassName="max-w-md mx-auto mt-10 p-6 bg-white rounded-lg shadow-md"><h1className="text-2xl font-bold mb-6 text-center">PlanningAssistant</h1>{isMounted&&(<AuthComponentsupabaseClient={supabase}appearance={{theme: ThemeSupa}}theme="light"providers={[]}/>)}</div>);}
Navigate to the /auth page in your browser.
Open the browser's developer console.
Observe the TypeError: Cannot read properties of null (reading 'useState') error.
Expected behaviour:
The @supabase/auth-ui-react component should render the authentication UI without errors.
Screenshots:
Desktop (please complete the following information):
OS: macOS
Browser: Chrome
Version: Version 130.0.6723.91 (Official Build) (arm64)
Additional context:
Node.js version: [e.g. 20.10.0]
npm version: [e.g. 10.2.3]
@supabase/auth-ui-react version: 0.4.7
react version: 19.0.0
next version: 15.2.3
I have tried using resolutions in my package.json to force @supabase/auth-ui-react to use the same React version as my project, but the error persists.
The error occurs even after updating Node.js and reinstalling dependencies.
This issue is reproducible on both local development and deployed Vercel environments.
Uh oh!
There was an error while loading. Please reload this page.
Bug Report: TypeError: Cannot read properties of null (reading 'useState') with @supabase/auth-ui-react
Describe the bug:
When using the
@supabase/auth-ui-react
library in a Next.js 15.2.3 application, I encounter aTypeError: Cannot read properties of null (reading 'useState')
error on the client-side when rendering theAuthComponent
. This error prevents the authentication UI from displaying correctly.To Reproduce:
Create a new Next.js 15.2.3 project.
Install the following dependencies:
Create a basic Supabase client setup.
Create an
/auth
page with the following code:Navigate to the
/auth
page in your browser.Open the browser's developer console.
Observe the
TypeError: Cannot read properties of null (reading 'useState')
error.Expected behaviour:
The
@supabase/auth-ui-react
component should render the authentication UI without errors.Screenshots:
Desktop (please complete the following information):
Additional context:
@supabase/auth-ui-react
version: 0.4.7react
version: 19.0.0next
version: 15.2.3resolutions
in mypackage.json
to force@supabase/auth-ui-react
to use the same React version as my project, but the error persists.Error Stack Trace:
The text was updated successfully, but these errors were encountered: