Facing issue with sign up

I'm working on a nextjs app with prisma, database on hoted supabase. I'm trying to do a simple sign up flow, but am getting this error:
....database. If you haven't generated the Prisma client, you need to run 'npx prisma generate'`);
7865 }
→ 7866 const result = await db[getModelName(model)].create({
data: {
id: "xkYF7mgMe4Jn8hGImGPoNTnw35A2LcIU",
name: "",
emailVerified: false,
createdAt: new Date("2025-03-10T07:50:35.758Z"),
updatedAt: new Date("2025-03-10T07:50:35.758Z"),
+ password: String
},
select: undefined
})

Argument `password` is missing.] {
clientVersion: '6.4.1'
}
....database. If you haven't generated the Prisma client, you need to run 'npx prisma generate'`);
7865 }
→ 7866 const result = await db[getModelName(model)].create({
data: {
id: "xkYF7mgMe4Jn8hGImGPoNTnw35A2LcIU",
name: "",
emailVerified: false,
createdAt: new Date("2025-03-10T07:50:35.758Z"),
updatedAt: new Date("2025-03-10T07:50:35.758Z"),
+ password: String
},
select: undefined
})

Argument `password` is missing.] {
clientVersion: '6.4.1'
}
Console error:
{message: 'Failed to create user', details: {…}, code: 'FAILED_TO_CREATE_USER', status: 422, statusText: 'UNPROCESSABLE_ENTITY'}
code
:
"FAILED_TO_CREATE_USER"
details
:
{name: 'PrismaClientValidationError', clientVersion: '6.4.1'}
message
:
"Failed to create user"
status
:
422
statusText
:
"UNPROCESSABLE_ENTITY"
[[Prototype]]
:
Object
{message: 'Failed to create user', details: {…}, code: 'FAILED_TO_CREATE_USER', status: 422, statusText: 'UNPROCESSABLE_ENTITY'}
code
:
"FAILED_TO_CREATE_USER"
details
:
{name: 'PrismaClientValidationError', clientVersion: '6.4.1'}
message
:
"Failed to create user"
status
:
422
statusText
:
"UNPROCESSABLE_ENTITY"
[[Prototype]]
:
Object
My schema generation is done using prisma, and my table is created. my auth.ts
import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient();
export const auth = betterAuth({
database: prismaAdapter(prisma, {
provider: "postgresql",
}),
emailAndPassword: {
enabled: true,
autoSignIn: true,
},
});
import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient();
export const auth = betterAuth({
database: prismaAdapter(prisma, {
provider: "postgresql",
}),
emailAndPassword: {
enabled: true,
autoSignIn: true,
},
});
7 Replies
Netrifier
Netrifier2mo ago
Can you give the starting part of this error message ....database. If you haven't generated the Prisma client it should be something like "Model ${model} does not exist in the database." Also can you share your prisma schema?
Argument password is missing.
This maybe indicates that the password field was not provided when the signUp.email was called
deepstretch
deepstretchOP2mo ago
Sure
2025-03-11T05:57:23.139Z ERROR [Better Auth]: Failed to create user [Error [PrismaClientValidationError]:
Invalid `db[getModelName(model)].create()` invocation in
/Users/--/workspace/folder-name/.next/server/chunks/node_modules_better-auth_dist_bb80db._.js:7866:62

7863 if (!db[getModelName(model)]) {
7864 throw new __TURBOPACK__imported__module__$5b$project$5d2f$workspace$2f$sunscreen$2d$checker$2f$node_modules$2f$better$2d$auth$2f$dist$2f$chunk$2d$UNWCXKMP$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["BetterAuthError"](`Model ${model} does not exist in the database. If you haven't generated the Prisma client, you need to run 'npx prisma generate'`);
7865 }
→ 7866 const result = await db[getModelName(model)].create({
data: {
id: "01bwUDA0036jOE48SPALcgaBpgT0hb3N",
name: "",
email: "----",
emailVerified: false,
createdAt: new Date("2025-03-11T05:57:23.130Z"),
updatedAt: new Date("2025-03-11T05:57:23.130Z"),
+ password: String
},
select: undefined
})

Argument `password` is missing.] {
clientVersion: '6.4.1'
}
POST /api/auth/sign-up/email 422 in 4842ms
2025-03-11T05:57:23.139Z ERROR [Better Auth]: Failed to create user [Error [PrismaClientValidationError]:
Invalid `db[getModelName(model)].create()` invocation in
/Users/--/workspace/folder-name/.next/server/chunks/node_modules_better-auth_dist_bb80db._.js:7866:62

7863 if (!db[getModelName(model)]) {
7864 throw new __TURBOPACK__imported__module__$5b$project$5d2f$workspace$2f$sunscreen$2d$checker$2f$node_modules$2f$better$2d$auth$2f$dist$2f$chunk$2d$UNWCXKMP$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["BetterAuthError"](`Model ${model} does not exist in the database. If you haven't generated the Prisma client, you need to run 'npx prisma generate'`);
7865 }
→ 7866 const result = await db[getModelName(model)].create({
data: {
id: "01bwUDA0036jOE48SPALcgaBpgT0hb3N",
name: "",
email: "----",
emailVerified: false,
createdAt: new Date("2025-03-11T05:57:23.130Z"),
updatedAt: new Date("2025-03-11T05:57:23.130Z"),
+ password: String
},
select: undefined
})

Argument `password` is missing.] {
clientVersion: '6.4.1'
}
POST /api/auth/sign-up/email 422 in 4842ms
redacted email and root folder name I am passing the password field, I can see it logged. Prisma client is present and so is my schema. I am passing my prisma client in auth.ts
Netrifier
Netrifier2mo ago
you are requiring the password in the user schema but it is stored in the account table https://www.better-auth.com/docs/concepts/database#account
Database | Better Auth
Learn how to use a database with Better Auth.
Netrifier
Netrifier2mo ago
the user entry is created first then the credential account is linked to the user table make sure to remove the password field from the user schema in primsa
deepstretch
deepstretchOP2mo ago
That was it. Created all the tables as per schema and it worked. Thank you so much. ----- I had a question though - does better auth facilitate sending a link with token in the email that lets the user authenticate upon sign in? Don't think I saw something specifically about that in the socs except for magic link.
Netrifier
Netrifier2mo ago
Email OTP | Better Auth
Email OTP plugin for Better Auth.
deepstretch
deepstretchOP2mo ago
Yes that is what I was looking for. Trying it out now. Thanks again.

Did you find this page helpful?