Unable to initialize and generate schema.ts for sqlite with genericOauth plugin.

I'm setting up my nuxt project and I want to configure better-auth to use my companies Oauth2/OIDC provider to authenticate against with the genericOauth plugin. When running npx @better-auth/cli@latest generate --config ./server/utils/auth.ts the database gets created in the right place, but it's empty and no schema is generated (see error message below). Any idea what's wrong with my setup? Thank you and BR Simon This is my server/utils/auth.ts:
import { betterAuth } from "better-auth"
import { genericOAuth } from "better-auth/plugins"
import Database from "better-sqlite3"

export const auth = betterAuth({
database: {
provider: "sqlite", // This tells Better Auth it's SQLite
type: "sqlite", // Add this line to be explicit
db: new Database("server/database/auth/local.db")
},
plugins: [
genericOAuth({
config: [
{
providerId: "sso",
clientId: process.env["NUXT_OAUTH_SSO_CLIENT_ID"] || '',
clientSecret: process.env["NUXT_OAUTH_SSO_CLIENT_SECRET"] || '',
discoveryUrl: process.env["NUXT_OAUTH_SSO_CONFIGURATION_URL"] || '',
},
]
})
]
})
import { betterAuth } from "better-auth"
import { genericOAuth } from "better-auth/plugins"
import Database from "better-sqlite3"

export const auth = betterAuth({
database: {
provider: "sqlite", // This tells Better Auth it's SQLite
type: "sqlite", // Add this line to be explicit
db: new Database("server/database/auth/local.db")
},
plugins: [
genericOAuth({
config: [
{
providerId: "sso",
clientId: process.env["NUXT_OAUTH_SSO_CLIENT_ID"] || '',
clientSecret: process.env["NUXT_OAUTH_SSO_CLIENT_SECRET"] || '',
discoveryUrl: process.env["NUXT_OAUTH_SSO_CONFIGURATION_URL"] || '',
},
]
})
]
})
And this is the output I get: ` npx @better-auth/cli@latest generate --config ./server/utils/auth.ts ⠋ preparing schema...file:///Users/taasasi8/.npm/_npx/05eee8cc65087e98/node_modules/better-auth/dist/shared/better-auth.D-L3RQ6y.mjs:1143 const tableMetadata = await db.introspection.getTables(); ^ TypeError: Cannot read properties of undefined (reading 'getTables')
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?