Unable to sign up using email / password
I keep getting this error when I sign up using email password in my next.js app
auth.ts
db.ts
TypeError: The "payload" argument must be of type object. Received null
at async signUpAction (actions/auth.ts:26:17)
24 | export async function signUpAction(formData: FormData) {
25 | try {
> 26 | const data = await auth.api.signUpEmail({
| ^
27 | body: {
28 | name: formData.get("name") as string,
29 | email: formData.get("email") as string, {
code: 'ERR_INVALID_ARG_TYPE'
}
POST /sign-up 200 in 660msTypeError: The "payload" argument must be of type object. Received null
at async signUpAction (actions/auth.ts:26:17)
24 | export async function signUpAction(formData: FormData) {
25 | try {
> 26 | const data = await auth.api.signUpEmail({
| ^
27 | body: {
28 | name: formData.get("name") as string,
29 | email: formData.get("email") as string, {
code: 'ERR_INVALID_ARG_TYPE'
}
POST /sign-up 200 in 660msauth.ts
export const auth = betterAuth({
database: prismaAdapter(db, {
provider: "postgresql",
}),
// baseURL,
emailAndPassword: {
enabled: true,
},
plugins: [nextCookies()],
})export const auth = betterAuth({
database: prismaAdapter(db, {
provider: "postgresql",
}),
// baseURL,
emailAndPassword: {
enabled: true,
},
plugins: [nextCookies()],
})db.ts
const projectDir = process.cwd()
loadEnvConfig(projectDir)
neonConfig.webSocketConstructor = WebSocket
const connectionString = `${env.DATABASE_URL}`
const pool = new Pool({ connectionString })
const adapter = new PrismaNeon(pool)
export const db = new PrismaClient({ adapter })const projectDir = process.cwd()
loadEnvConfig(projectDir)
neonConfig.webSocketConstructor = WebSocket
const connectionString = `${env.DATABASE_URL}`
const pool = new Pool({ connectionString })
const adapter = new PrismaNeon(pool)
export const db = new PrismaClient({ adapter })