`useNumberId` is set, but `id` is still a string?

Hey, I'm using useNumberId: true in my betterAuth config (with an SQLite database), but I'm still seeing that the user id is a string in my auth middleware. Did I miss something ? Thanks in advance :).
export const auth = betterAuth({
...
advanced: {
database: {
useNumberId: true,
},
},
...
}
export const auth = betterAuth({
...
advanced: {
database: {
useNumberId: true,
},
},
...
}
export const authMiddleware = createMiddleware({ type: "function" }).server(async ({ next }) => {
const { headers } = getWebRequest();
const session = await auth.api.getSession({ headers, query: { disableCookieCache: true } });

if (!session) {
throw redirect({ to: "/", search: { authExpired: true }, statusCode: 401 });
}

return next({ context: { currentUser: session.user } });
});

user: {
id: string
....
}
export const authMiddleware = createMiddleware({ type: "function" }).server(async ({ next }) => {
const { headers } = getWebRequest();
const session = await auth.api.getSession({ headers, query: { disableCookieCache: true } });

if (!session) {
throw redirect({ to: "/", search: { authExpired: true }, statusCode: 401 });
}

return next({ context: { currentUser: session.user } });
});

user: {
id: string
....
}
Solution:
In order for existing plugins and libraries that work around Better-auth to continue to function, the id value has to remain a string. Our adapter system will automatically convert the id from string to int and vice versa when interacting with DB....
Jump to solution
2 Replies
Solution
Ping
Ping4mo ago
In order for existing plugins and libraries that work around Better-auth to continue to function, the id value has to remain a string. Our adapter system will automatically convert the id from string to int and vice versa when interacting with DB.
Cross
CrossOP4mo ago
ok so this change is only on the db side. Thanks for the answer :).

Did you find this page helpful?