Can't create Organizations using convex

Hey. I am currently starting an app with nextjs and convex. I had already setup auth and github + email and password no problem. I went through the recommended way (using a betterAuth convex component). But when trying to create organizations with authClient i'm hitting an error:
Sep 29, 17:32:15.417
failure

157ms
Q


adapter:findMany
Uncaught TypeError: Cannot read properties of undefined (reading 'fields')
at find [as find] (<anonymous>)
Sep 29, 17:32:15.419
H

POST /api/auth/organization/create
error
# SERVER_ERROR: [Error: Uncaught TypeError: Cannot read properties of undefined (reading 'fields')
at find [as find] (<anonymous>)
]
Sep 29, 17:32:15.417
failure

157ms
Q


adapter:findMany
Uncaught TypeError: Cannot read properties of undefined (reading 'fields')
at find [as find] (<anonymous>)
Sep 29, 17:32:15.419
H

POST /api/auth/organization/create
error
# SERVER_ERROR: [Error: Uncaught TypeError: Cannot read properties of undefined (reading 'fields')
at find [as find] (<anonymous>)
]
Here's my auth config:
export const authComponent = createClient<DataModel>(components.betterAuth);

export const createAuth = (
ctx: GenericCtx<DataModel>,
{ optionsOnly } = { optionsOnly: false },
) => {
return betterAuth({
baseURL: siteUrl,
emailAndPassword: {
enabled: true,
async sendResetPassword(data, request) {
// Send an email to the user with a link to reset their password
},
},
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
},
},
logger: {
disabled: optionsOnly,
},
baseUrl: siteUrl,
trustedOrigins: [siteUrl],
database: authComponent.adapter(ctx),
plugins: [
convex(),
passkey(),
organization(),
],
});
};
export const authComponent = createClient<DataModel>(components.betterAuth);

export const createAuth = (
ctx: GenericCtx<DataModel>,
{ optionsOnly } = { optionsOnly: false },
) => {
return betterAuth({
baseURL: siteUrl,
emailAndPassword: {
enabled: true,
async sendResetPassword(data, request) {
// Send an email to the user with a link to reset their password
},
},
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
},
},
logger: {
disabled: optionsOnly,
},
baseUrl: siteUrl,
trustedOrigins: [siteUrl],
database: authComponent.adapter(ctx),
plugins: [
convex(),
passkey(),
organization(),
],
});
};
auth-client:
export const authClient = createAuthClient({
plugins: [organizationClient(), convexClient(), passkeyClient()],
});
export const authClient = createAuthClient({
plugins: [organizationClient(), convexClient(), passkeyClient()],
});
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?