Problems with infering client session from a monorepo
I have a monorepo using nextjs and hono. Since I don't want to have the better-auth config in the backend I created a package to handle all that part and import it from my client and my server instead of having an absolute path.
So I created an method called
createAuth which is going to build the authInstance to use it on the server and also it's going to return a type to use it on the client to infer that part.
Since I updated to the v1.3.27 I started getting issues with the types so I have to remove the declaration: true prop from my auth package. That fixed the error that I had with TS but the session is not infered on the client.
I want to know if there's a work around for a case like this or what I should do with that the reference that I used is this page of the docs: https://www.better-auth.com/docs/concepts/session-management#customizing-session-response
I created a repository with the necesary changes to reproduce my issues:
https://github.com/csdev19/test-mi-condominio-appGitHub
GitHub - csdev19/test-mi-condominio-app
Contribute to csdev19/test-mi-condominio-app development by creating an account on GitHub.
Session Management | Better Auth
Better Auth session management.


6 Replies
Even if I directly instanciate the the betterAuth method I'm still getting that error 😫

Well I'm not really sure why but this error only happens on the v1.3.27 I had to downgrade to the v1.2.10 to keep working on my project I was stuck with that on the compilation side

@Cristian Sotomayor I am also having an issue with this in v1.3.27 with inferring the user and session types. Downgrading to 1.3.26 fixed it for me. Perhaps it was because of this

That's really interesting!!! Thanks I'm going to try that. I would like to have the latest version so I'm going to keep this post opened
I found I was also getting the same issue with Admin plugin when client calls the getUserList endpoint in 1.3.27.