Getting UNPROCESSABLE_ENTITY when attempting to sign up a new user

Hitting another issue with Better Auth where I get an error when attempting to do the following:
authClient.signUp.email({
name: "Test User",
password: "password1234",
username: "test"
})
authClient.signUp.email({
name: "Test User",
password: "password1234",
username: "test"
})
I receive this error:
BetterCallAPIError: API Error: UNPROCESSABLE_ENTITY Failed to create user
cause: {
"message": "Failed to create user",
"details": {
"length": 164,
"name": "error",
"severity": "ERROR",
"code": "22P02",
"where": "unnamed portal parameter $1 = '...'",
"originalLine": 156,
"originalColumn": 12,
"file": "uuid.c",
"routine": "string_to_uuid",
"stack": "error: invalid input syntax for type uuid: \"fc0vhdcGvNCF6VDIqXCvfSAxuLCAMxJc\"\n at <anonymous> (/Users/dsanchez/Developer/github/dsanchez/time-tracker/node_modules/pg-pool/index.js:45:11)\n at processTicksAndRejections (native:7:39)"
},
"code": "FAILED_TO_CREATE_USER"
}
BetterCallAPIError: API Error: UNPROCESSABLE_ENTITY Failed to create user
cause: {
"message": "Failed to create user",
"details": {
"length": 164,
"name": "error",
"severity": "ERROR",
"code": "22P02",
"where": "unnamed portal parameter $1 = '...'",
"originalLine": 156,
"originalColumn": 12,
"file": "uuid.c",
"routine": "string_to_uuid",
"stack": "error: invalid input syntax for type uuid: \"fc0vhdcGvNCF6VDIqXCvfSAxuLCAMxJc\"\n at <anonymous> (/Users/dsanchez/Developer/github/dsanchez/time-tracker/node_modules/pg-pool/index.js:45:11)\n at processTicksAndRejections (native:7:39)"
},
"code": "FAILED_TO_CREATE_USER"
}
I'm wondering if this is because Better Auth does not like the fact that I modified the primary keys of the default Drizzle tables it generated for me to use uuid instead of integer?
import { pgSchema, uuid } from "drizzle-orm/pg-core";

export const authSchema = pgSchema("auth");

export const UserTable = authSchema.table("user", {
id: uuid("id").defaultRandom().primaryKey(), // <-- did this to all the default tables
});
import { pgSchema, uuid } from "drizzle-orm/pg-core";

export const authSchema = pgSchema("auth");

export const UserTable = authSchema.table("user", {
id: uuid("id").defaultRandom().primaryKey(), // <-- did this to all the default tables
});
Appreciate any and all help with this
2 Replies
bekacru
bekacru2mo ago
disable auto generated ids by setting advanced.generateId false in your auth config
MaveriX89
MaveriX89OP2mo ago
Ah, thank you -- that did the trick!

Did you find this page helpful?