advanced.generateId: false is ignored in 1.2.6 with drizzleAdapter

Hi everyone, After updating to v1.2.6, I've encountered a problem where better-auth is generating IDs, which conflicts with my database that relies on UUIDs. The issue seems most likely related to the drizzleAdapter, as similar problems appeared with the passkey and emailOTP plugins. I temporarily downgraded to v1.2.5 to avoid the error, which looks like this:
# SERVER_ERROR: [error: invalid input syntax for type uuid: "whFaJpiOdr2ppkZD4lOP19hsh08acoT2"] {
length: 164,
severity: 'ERROR',
code: '22P02',
...,
routine: 'string_to_uuid'
}
# SERVER_ERROR: [error: invalid input syntax for type uuid: "whFaJpiOdr2ppkZD4lOP19hsh08acoT2"] {
length: 164,
severity: 'ERROR',
code: '22P02',
...,
routine: 'string_to_uuid'
}
To reproduce:
Install [email protected] and use the following auth configuration (note that the issue is likely with drizzleAdapter):
export const auth = betterAuth({
appName: process.env.NAME,
database: drizzleAdapter(db, {
provider: "pg",
schema: schema
}),
advanced: {
generateId: false,
},
emailAndPassword: {
enabled: true,
password: {
verify: async (data) => true // For easier debugging
}
},
plugins: [
passkey({
rpID: process.env.RP_ID,
rpName: process.env.NAME,
origin: process.env.ORIGIN,
}),
emailOTP({
sendVerificationOnSignUp: false,
disableSignUp: true,
async sendVerificationOTP({ email, otp, type }) { /* ... */ },
}),
nextCookies()
],
});
export const auth = betterAuth({
appName: process.env.NAME,
database: drizzleAdapter(db, {
provider: "pg",
schema: schema
}),
advanced: {
generateId: false,
},
emailAndPassword: {
enabled: true,
password: {
verify: async (data) => true // For easier debugging
}
},
plugins: [
passkey({
rpID: process.env.RP_ID,
rpName: process.env.NAME,
origin: process.env.ORIGIN,
}),
emailOTP({
sendVerificationOnSignUp: false,
disableSignUp: true,
async sendVerificationOTP({ email, otp, type }) { /* ... */ },
}),
nextCookies()
],
});
Any guidance or fixes would be greatly appreciated. Thanks,
Rémi
Solution:
okay try disabling auto generated Ids by setting advanced.database.generateId to false
Jump to solution
4 Replies
bekacru
bekacru2w ago
try upgrading 1.2.7-beta.1 and let me know we'll publish the patch soon
remib18
remib18OP2w ago
The issue persists after updating Thanks for the quick answer btw
Solution
bekacru
bekacru2w ago
okay try disabling auto generated Ids by setting advanced.database.generateId to false
remib18
remib18OP2w ago
Alright that solved it ! It also works on the 1.2.6

Did you find this page helpful?