Next.js [Admin] [Username] listUsers() returns UserWithRole[] missing property `username`

I'm using two plugins, Admin and Username. I'm currently building my admin dashboard and I'm listing all users in a server action like this:
const response = await authClient.admin.listUsers(
{
query: {
limit: 100
}
},
{ headers: headers() }
)
const response = await authClient.admin.listUsers(
{
query: {
limit: 100
}
},
{ headers: headers() }
)
This works but returns the data with the type UserWithRole[] and is missing property username I read something about infering types, but I don't know if that's the right way. I would appreciate any help. ty
4 Replies
lonelyplanet
lonelyplanet2mo ago
whats the auth config look like
lonelyplanet
lonelyplanet2mo ago
now i dont know if it is the case but try changing up the order of your plugins, since i know for nextCookies it needs to be the last plugin according to the docs so you could try putting username plugin before admin plugin
Next.js integration | Better Auth
Integrate Better Auth with Next.js.
janusanus
janusanusOP2mo ago
thanks for the reply, i tried switching them up, but it still doesn't work here is the UserWithRole if it helps
type UserWithRole = {
id: string;
email: string;
emailVerified: boolean;
name: string;
createdAt: Date;
updatedAt: Date;
image?: string | null | undefined;
role?: string | null;
banned?: boolean | null;
banReason?: string | null;
banExpires?: Date | null;
}
type UserWithRole = {
id: string;
email: string;
emailVerified: boolean;
name: string;
createdAt: Date;
updatedAt: Date;
image?: string | null | undefined;
role?: string | null;
banned?: boolean | null;
banReason?: string | null;
banExpires?: Date | null;
}
lonelyplanet
lonelyplanet2mo ago
I dont know alot about better auth was just a idea @bekacru will know

Did you find this page helpful?