Schema adjustment not being reflected.
Hi guys, 
I'm hoping someone may be able to give me hand with this, I'm 90% confident I'm missing an extra step here or something.
I have a 
/schemas/ folder, with multiple different files and an entry index.ts which exports * from the different files.
Inside my auth.ts file, I have the drizzleAdapter, and I pass in the schemas like so:
One of the schemas I have defined is named under auth.ts. It includes the user and the session tables. This is what the session table looks like:
After making these changes, I have ran npm run db:generate as well as npm run db:push.
When navigating to local.drizzle.studio I can see the extra columns created under the session table.
However, when I use getSession or the database hooks to manipulate the session object, when I hover over the object I see the following structure (Image attached).
Does anyone know how I should go about aligning the better auth types with my DB structs? Thanks
11 Replies
Hi there! I'm Better Auth Bot. Here are some common Better Auth topics and best practices our community has been discussing:
1. Social and OAuth Providers:
Many developers ask how to set up various social login providers. Better Auth now supports providers like Google, LINE, Kakao, Naver, and even experimental support for 42 (École 42) authentication [27], [28]. For each provider, you can configure client IDs, secrets, and endpoints following our standard OAuth2 flow. Check our documentation for detailed setup instructions on each provider. 2. Passkey Plugin Enhancements:
There has been a lot of chatter about passkey sign-in improvements. Recent updates include adding client-side options like setting the
Some users were concerned about runtime errors in non-Node.js environments. We updated the telemetry detection logic to avoid referencing
Another question is about calling admin endpoints directly from the server (e.g., in background tasks). Our recent fixes allow internal invocations that bypass some of the usual session checks while still guarding against security issues
Many developers ask how to set up various social login providers. Better Auth now supports providers like Google, LINE, Kakao, Naver, and even experimental support for 42 (École 42) authentication [27], [28]. For each provider, you can configure client IDs, secrets, and endpoints following our standard OAuth2 flow. Check our documentation for detailed setup instructions on each provider. 2. Passkey Plugin Enhancements:
There has been a lot of chatter about passkey sign-in improvements. Recent updates include adding client-side options like setting the
authenticatorAttachment and global configurations for authenticatorSelection to enforce server-side policies [23]. Also, regarding the callbackUrl for the passkey signIn flow, earlier discussions led to its removal from docs, but we're always reviewing feedback for potential reintroduction [21].
3. Telemetry and Runtime Compatibility:Some users were concerned about runtime errors in non-Node.js environments. We updated the telemetry detection logic to avoid referencing
process directly by safely accessing environment variables, which prevents crashes in edge and bundler scenarios [1].
4. Admin Endpoints:Another question is about calling admin endpoints directly from the server (e.g., in background tasks). Our recent fixes allow internal invocations that bypass some of the usual session checks while still guarding against security issues
GitHub
Build software better, together
GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.

GitHub
Build software better, together
GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.

GitHub
better-auth/better-auth
The most comprehensive authentication framework for TypeScript - better-auth/better-auth
GitHub
Build software better, together
GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.

[8]. This makes it easier to perform administrative operations in server-side scripts.
5. OpenAPI and Error Handling Improvements:
To help clients properly handle errors such as duplicate emails or invalid usernames, we’ve added support for the
Our new OAuth 2.1 provider plugin supports features like dynamic client registration, PKCE, introspection, and robust token validation [11]. Also, the JWT handling has been updated to remove direct reliance on global crypto objects, making it more compatible across different runtimes [5]. These are just a few aggregated topics based on community questions and our latest changes. If you have any further details to discuss or need help with specific configuration issues, feel free to ask! Let me know how I can help further!
To help clients properly handle errors such as duplicate emails or invalid usernames, we’ve added support for the
422 Unprocessable Entity response in our OpenAPI specs for several endpoints [4], [24]. This standardizes error responses and makes client-side validation more straightforward.
6. OAuth 2.1 Provider Plugin and JWT Improvements:Our new OAuth 2.1 provider plugin supports features like dynamic client registration, PKCE, introspection, and robust token validation [11]. Also, the JWT handling has been updated to remove direct reliance on global crypto objects, making it more compatible across different runtimes [5]. These are just a few aggregated topics based on community questions and our latest changes. If you have any further details to discuss or need help with specific configuration issues, feel free to ask! Let me know how I can help further!
GitHub
Build software better, together
GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.

GitHub
Build software better, together
GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.

GitHub
Build software better, together
GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.

GitHub
Build software better, together
GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.

Sources:
[1] fix(telemetry): 
process referenced on non-nodejs runtime
[4] feat: openapi 422 response
[5] fix: remove use of global.crypto
[8] fix(admin): allow calling admin endpoints in server
[11] feat(oauth-provider): an oauth 2.1 compliant plugin
[21] [Passkey plugin] implement signIn callbackUrl
[23]  feat: passkey plugin with client-side authenticatorAttachment and global authenticatorSelection configuration
[24] feat: openapi 422 response
[27] feat(social): add Line provider
[28] Feat/42 providerGitHub
fix(telemetry): 
process referenced on non-nodejs runtime by Kinfe...closes #3998
Summary by cubic
Updated telemetry detection logic to avoid referencing process in non-Node.js runtimes, preventing runtime errors.
Bug Fixes
Used a shared env utility to access envi...
GitHub
feat: openapi 422 response by Z377A1 · Pull Request #4477 · bette...
This adds the 422 Unprocessable Entity response to the OpenAPI specification for the following endpoints:
/sign-up/email
/update-user
/sign-in/username
The 422 Unprocessable Entity response is us...
GitHub
fix: remove use of 
global.crypto by himself65 · Pull Request #46...Related: #4471
This has been brought in a very old version, since 0.8. So I don't think this will fix the issue, but let's not use crypto
Summary by cubic
Remove direct use of glo...
GitHub
fix(admin): allow calling admin endpoints in server by frectonz · ...
closes #3717
Summary by cubic
Enables calling admin plugin endpoints from server-side code without an HTTP request, fixing failures in background tasks and internal jobs. External requests still ...
GitHub
feat(oauth-provider): an oauth 2.1 compliant plugin by dvanmali · ...
oAuth 2.1 Provider
An upgrade to oidc-provider plugin that makes it oauth2.1 compliant and has a configuration that is secure by default.
Plans for the deprecation of oidc-provider plugin due to ma...
add additonal fields via better auth instead of schema level
TypeScript | Better Auth
Better Auth TypeScript integration.
that way better auth is aware of it and does the schema stuff for you
for future reference just note that the ai bot only accesses the single message you send it; no additional context/memory
So when using plugins such as the 
admin plugin, which requires the impersonatedBy property on the session object, how come this isn't something handled within the underlying plugin? Or the organizations plugin which attaches the activeOrganizationId property on the session.
Makes sense.. thanksIt is, you have to use the better auth cli commands to generate the auth schema again
but all that does under the hood is spit out a file which i then run using db:generate on right? because i have already done this previsouly, but i just haven't used the new schema generated. i used my own with the same properties
it doesn't look like it adjusts any structs better auth uses under the hood for the session object
@Max apologies for the ping, wondering if you could take a look over some of the comments in this thread and share some assistance if possible! Thanks
The DB hooks doesn't infer correctly, so you're looking at incorrect types. If you were to console.log the data returned in the DB hooks you would see all of your data there
We intend on fixing DB hook types.
Ah ok, is this documented anywhere?

