`user.additionalFields` aren't being returned when using `admin.listUsers`

Hi 👋 I'm showing users table in admin and using admin.listUsers to get the data. However, I'm not getting columns I already mentioned in user.additionalFields config. Here's how I configured:
export const auth = betterAuth({
additionalFields: {
lastSignInAt: {
type: 'date',
fieldName: 'last_sign_in_at',
validator: {
input: z.iso.datetime(),
},
required: true,
input: false,
},
deactivatedAt: {
type: 'date',
fieldName: 'deactivated_at',
validator: {
input: z.nullable(z.iso.datetime()),
},
required: false,
input: false,
},
},
})
export const auth = betterAuth({
additionalFields: {
lastSignInAt: {
type: 'date',
fieldName: 'last_sign_in_at',
validator: {
input: z.iso.datetime(),
},
required: true,
input: false,
},
deactivatedAt: {
type: 'date',
fieldName: 'deactivated_at',
validator: {
input: z.nullable(z.iso.datetime()),
},
required: false,
input: false,
},
},
})
However, user inferences is also configured and it shows those additional fields in types but can't get the in actual JS object.
export type Session = typeof auth.$Infer.Session
export type User = Simplify<Omit<Session['user'], 'id'> & { id: number }>
export type Session = typeof auth.$Infer.Session
export type User = Simplify<Omit<Session['user'], 'id'> & { id: number }>
Apart from admin.listUsers I'm also not getting them when user sign in inside session.
3 Replies
Ata Sanchez
Ata Sanchez5w ago
Same error here
jd_solanki
jd_solankiOP5w ago
Attaching issue link for reference: https://github.com/better-auth/better-auth/issues/4870
GitHub
user.additionalFields aren't being returned when using `admin.lis...
Is this suited for github? Yes, this is suited for github To Reproduce Hi 👋🏻 I&#39;m showing users table in admin and using admin.listUsers to get the data. However, I&#39;m not getting the columns...
jd_solanki
jd_solankiOP5w ago
GitHub
user.additionalFields aren't being returned when using `admin.lis...
Is this suited for github? Yes, this is suited for github To Reproduce Hi 👋🏻 I&#39;m showing users table in admin and using admin.listUsers to get the data. However, I&#39;m not getting the columns...

Did you find this page helpful?