Version ^1.2.12, the authClient.useListOrganizations has no call signature

No description
Solution:
You're importing createAuthClient from better-auth/client. Change the import path to better-auth/react
Jump to solution
4 Replies
Ping
Ping4mo ago
Can I see your auth client file?
cardinal
cardinalOP4mo ago
sure
import { serverOnly } from "@tanstack/react-start";
import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { anonymous, organization } from "better-auth/plugins";
import { reactStartCookies } from "better-auth/react-start";
import { PrismaClient } from "~prisma/generated/client";

const prisma = new PrismaClient();

const getAuthConfig = serverOnly(() =>
betterAuth({
database: prismaAdapter(prisma, {
provider: "sqlite",
}),
emailAndPassword: {
enabled: true,
},
plugins: [organization(), anonymous(), reactStartCookies()],
session: {
cookieCache: {
enabled: true,
maxAge: 5 * 60
}
}
})
)

export const auth = getAuthConfig();
import { serverOnly } from "@tanstack/react-start";
import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { anonymous, organization } from "better-auth/plugins";
import { reactStartCookies } from "better-auth/react-start";
import { PrismaClient } from "~prisma/generated/client";

const prisma = new PrismaClient();

const getAuthConfig = serverOnly(() =>
betterAuth({
database: prismaAdapter(prisma, {
provider: "sqlite",
}),
emailAndPassword: {
enabled: true,
},
plugins: [organization(), anonymous(), reactStartCookies()],
session: {
cookieCache: {
enabled: true,
maxAge: 5 * 60
}
}
})
)

export const auth = getAuthConfig();
and auth client
import { createAuthClient } from "better-auth/client";
import { organizationClient } from "better-auth/client/plugins";

export const authClient = createAuthClient({
plugins: [organizationClient()],
baseURL: "http://localhost:3000",
});
import { createAuthClient } from "better-auth/client";
import { organizationClient } from "better-auth/client/plugins";

export const authClient = createAuthClient({
plugins: [organizationClient()],
baseURL: "http://localhost:3000",
});
Solution
Ping
Ping4mo ago
You're importing createAuthClient from better-auth/client. Change the import path to better-auth/react
cardinal
cardinalOP4mo ago
perfect! thank you

Did you find this page helpful?