getSession() doesn't return user table additional fields
I cannot get changedFirstPasswordAt field in the hooks.server.ts from user table.
Any idea ?



15 Replies
@Heyells you ran the schema generation and migrated correct? These additional fields will only work after that is completed
hmm good question
See Generate and Migrate sections:
https://www.better-auth.com/docs/concepts/cli#generate
CLI | Better Auth
Built-in CLI for managing your project.
if it is in my db, the generation has been done ?
Are you able to share hooks.server.ts file?
Hastebin
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
I'm not a svelte dev, but I doubt its the svelte-kit integration - that just wraps the API routes for you.
This is likely your additional fields not being available - where exactly are you trying to use them that this might be failing?
I think its related to encoding/decoding dates. I see now - the gender parameter comes but not the changedFirstPasswordAt
it is a me issue or a bug ?
what database adapter are you using?
DrizzleORM
would need to know more... can you create a separate project that reproduces the issue minimally? or at least share your package.json that shows the version numbers of these libraries. I'm assuming you're up to date on drizzle, better-auth, etc.
@Heyells You should look into the customSession plugin: https://www.better-auth.com/docs/concepts/session-management#customizing-session-response
Session Management | Better Auth
Better Auth session management.
I went through the code and it may be because it uses the key from the schema object and not the fieldName
Let me try to rename the key with underscore to align with the fieldName
didn't work
I will do that but I think its an issue because my gender addition field work properly
it works thank you
It's intentional that we don't pass any additional fields, not a bug or something that's overlooked.
ah ok. So it's ok then
customSession works fine
thank you