Renamed email field via auth config results in auth error

Using better-auth@1.3.8-beta.3 with prisma adapter I've renamed several columns via the auth config (to use snake case column names), and also changed the database column names (via prisma migration). But upon logging in there's a query error thrown which is attempting to use the custom field name email_address instead of the prisma model name email. auth.ts
...
user: {
fields: {
email: "email_address",
createdAt: "created_at",
emailVerified: "email_verified",
image: "image_url",
updatedAt: "updated_at",
},
},
...
...
user: {
fields: {
email: "email_address",
createdAt: "created_at",
emailVerified: "email_verified",
image: "image_url",
updatedAt: "updated_at",
},
},
...
schema.prisma
model User {
...
email String @map("email_address")
...
}
model User {
...
email String @map("email_address")
...
}
Error after login:
web:dev: 2025-08-28T18:56:17.248Z ERROR [Better Auth]: Better auth was unable to query your database. web:dev: Error: Error [PrismaClientValidationError]: web:dev: Invalid prisma.user.findFirst() invocation: web:dev: web:dev: { web:dev: where: { web:dev: email_address: "email@gmail.com", web:dev: ~~~~~ web:dev: ? AND?: UserWhereInput | UserWhereInput[], web:dev: ? OR?: UserWhereInput[], web:dev: ? NOT?: UserWhereInput | UserWhereInput[], web:dev: ? id?: StringFilter | String, web:dev: ? name?: StringFilter | String, web:dev: ? email?: StringFilter | String, web:dev: ? emailVerified?: BoolFilter | Boolean, web:dev: ? image?: StringNullableFilter | String | Null, web:dev: ? createdAt?: DateTimeFilter | DateTime, web:dev: ? updatedAt?: DateTimeFilter | DateTime, web:dev: ? sessions?: SessionListRelationFilter, web:dev: ? accounts?: AccountListRelationFilter web:dev: }, web:dev: select: undefined web:dev: } web:dev: web:dev: Unknown argument email_address. Available options are marked with ?. web:dev: at ignore-listed frames { web:dev: clientVersion: '6.15.0' web:dev: }
2 Replies
4:44
4:4416h ago
Why 😭
nick
nickOP16h ago
Why am i attempting to rename? Hmm - now i understand the why. The fields customisation in auth config is just if you want to change the model properties, not the column names 🤦‍♂️ Reverting the auth config changes and just using the @map in the schema.prisma works as expected.

Did you find this page helpful?