Column account.type / account.provider does not exist
Not sure if this is a bug, followed the getting started guidelines.
Brand new setup with next.js + supabase + prisma:
package.json
auth.ts:
Ran:
Then
Schema output:
Try:
Get:
and after adding
Brand new setup with next.js + supabase + prisma:
package.json
"@prisma/adapter-pg": "^6.16.2",
"@prisma/client": "^6.16.2",
"better-auth": "^1.3.23",
"next": "15.5.4",
"prisma": "^6.16.2",
"react": "19.1.0",
"react-dom": "19.1.0" "@prisma/adapter-pg": "^6.16.2",
"@prisma/client": "^6.16.2",
"better-auth": "^1.3.23",
"next": "15.5.4",
"prisma": "^6.16.2",
"react": "19.1.0",
"react-dom": "19.1.0"auth.ts:
import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { PrismaClient } from "../generated/prisma";
const prisma = new PrismaClient();
export const auth = betterAuth({
database: prismaAdapter(prisma, {
provider: "postgresql",
}),
emailAndPassword: {
enabled: true,
},
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID as string,
clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
},
},
secret: process.env.BETTER_AUTH_SECRET,
baseURL: process.env.BETTER_AUTH_URL,
});import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { PrismaClient } from "../generated/prisma";
const prisma = new PrismaClient();
export const auth = betterAuth({
database: prismaAdapter(prisma, {
provider: "postgresql",
}),
emailAndPassword: {
enabled: true,
},
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID as string,
clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
},
},
secret: process.env.BETTER_AUTH_SECRET,
baseURL: process.env.BETTER_AUTH_URL,
});Ran:
npx @better-auth/cli@latest generate
ā Do you want to generate the schema to ./prisma/schema.prisma? ... yes
2025-09-29T09:00:42.674Z SUCCESS [Better Auth]: š Schema was generated successfully!npx @better-auth/cli@latest generate
ā Do you want to generate the schema to ./prisma/schema.prisma? ... yes
2025-09-29T09:00:42.674Z SUCCESS [Better Auth]: š Schema was generated successfully!Then
npx prisma db pushnpx prisma db push:Your database is now in sync with your Prisma schema. Done in 3.70sYour database is now in sync with your Prisma schema. Done in 3.70sSchema output:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id
name String
email String
emailVerified Boolean @default(false)
image String?
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
sessions Session[]
accounts Account[]
@@unique([email])
@@map("user")
}
model Session {
id String @id
expiresAt DateTime
token String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
ipAddress String?
userAgent String?
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([token])
@@map("session")
}
model Account {
id String @id
accountId String
providerId String
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
accessToken String?
refreshToken String?
idToken String?
accessTokenExpiresAt DateTime?
refreshTokenExpiresAt DateTime?
scope String?
password String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("account")
}
model Verification {
id String @id
identifier String
value String
expiresAt DateTime
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
@@map("verification")
}generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id
name String
email String
emailVerified Boolean @default(false)
image String?
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
sessions Session[]
accounts Account[]
@@unique([email])
@@map("user")
}
model Session {
id String @id
expiresAt DateTime
token String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
ipAddress String?
userAgent String?
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([token])
@@map("session")
}
model Account {
id String @id
accountId String
providerId String
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
accessToken String?
refreshToken String?
idToken String?
accessTokenExpiresAt DateTime?
refreshTokenExpiresAt DateTime?
scope String?
password String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("account")
}
model Verification {
id String @id
identifier String
value String
expiresAt DateTime
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
@@map("verification")
}Try:
await authClient.signIn.email({
email: "user@example.com",
password: "password123",
});
await authClient.signUp.email({
email: "user@example.com",
password: "password123",
name: "Test User",
}); await authClient.signIn.email({
email: "user@example.com",
password: "password123",
});
await authClient.signUp.email({
email: "user@example.com",
password: "password123",
name: "Test User",
});Get:
# SERVER_ERROR: Error [PrismaClientKnownRequestError]:
Invalid `prisma.account.findMany()` invocation:
The column `account.type` does not exist in the current database.# SERVER_ERROR: Error [PrismaClientKnownRequestError]:
Invalid `prisma.account.findMany()` invocation:
The column `account.type` does not exist in the current database.and after adding
type String?type String? repushing, restarting get:# SERVER_ERROR: Error [PrismaClientKnownRequestError]:
Invalid `prisma.account.findMany()` invocation:
The column `account.provider` does not exist in the current database.# SERVER_ERROR: Error [PrismaClientKnownRequestError]:
Invalid `prisma.account.findMany()` invocation:
The column `account.provider` does not exist in the current database.Solution
Following this guide worked:
https://www.prisma.io/docs/guides/betterauth-nextjs
It was:
Instead of:
That fixed it.
https://www.prisma.io/docs/guides/betterauth-nextjs
It was:
npx @better-auth/cli generatenpx @better-auth/cli generateInstead of:
npx @better-auth/cli@latest generatenpx @better-auth/cli@latest generateThat fixed it.