getSession() doesn't return user table additional fields

I cannot get changedFirstPasswordAt field in the hooks.server.ts from user table. Any idea ?
No description
No description
No description
15 Replies
zpg6
zpg62w ago
@Heyells you ran the schema generation and migrated correct? These additional fields will only work after that is completed
Heyells
HeyellsOP2w ago
hmm good question
zpg6
zpg62w ago
CLI | Better Auth
Built-in CLI for managing your project.
Heyells
HeyellsOP2w ago
if it is in my db, the generation has been done ?
zpg6
zpg62w ago
Are you able to share hooks.server.ts file?
Heyells
HeyellsOP2w ago
Hastebin
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
zpg6
zpg62w ago
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
Heyells
HeyellsOP2w ago
it is a me issue or a bug ?
zpg6
zpg62w ago
what database adapter are you using?
Heyells
HeyellsOP7d ago
DrizzleORM
zpg6
zpg67d ago
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.
Ping
Ping7d ago
Session Management | Better Auth
Better Auth session management.
Heyells
HeyellsOP7d ago
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
Ping
Ping6d ago
It's intentional that we don't pass any additional fields, not a bug or something that's overlooked.
Heyells
HeyellsOP6d ago
ah ok. So it's ok then customSession works fine thank you

Did you find this page helpful?