Mika
Mika
BABetter Auth
Created by Mika on 3/22/2025 in #help
authClient.useSession() not callable in my Nextjs (15.2) client component
Hello. I use nextjs 15.2 and better-auth 1.2.4 I défined auth client like that:
export const authClient = createAuthClient({ plugins: [emailOTPClient()], }); export const { useSession } = authClient;
I use it in client component like that :
"use client"; import { authClient } from "@/lib/auth/auth-client"; export const MyClientComp = () => { const { data: session, isPending, error, refetch } = authClient.useSession(); return <div>Coucou</div>; }
but i have this error
This expression is not callable. No constituent of type 'Atom<{ data: { user: { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; session: { id: string; createdAt: Date; ... 5 more ...; userAgent?: string | ... 1 more ... | undefined; }; } | null; error: BetterFetchError | null; isPendi...' is callable.ts(2349)
Someone have an idea ? Best regards, Mika
2 replies