Organization: OrganizationClient does not seem to add interfaces to authClient
I am attempting to configure the Organization Plugin using Better Auth 1.3.7. I have the following server/client configuration:
And here is the client:
With the above config, when I attempt to use
authClient.organization
I only see checkRolePermission
as an available API and none of the other organization APIs (i.e. hasPermission
, listMembers
, etc.).
What is going on here?45 Replies
@Better Auth what can you tell me about this post?
Hi there! Could you please clarify which post you're referring to? There have been several posts and commits about Better Authโfrom dependency updates [1] to specific provider patches [16]. Let me know which one you mean, and I'll be happy to help!
Sources:
[1] fix(deps): update better-auth dependencies
[16] twitter patch
GitHub
fix(deps): update better-auth dependencies by renovate[bot] ยท Pull...
This PR contains the following updates:
Package
Change
Age
Confidence
@better-auth/utils
0.2.5 -> 0.2.6
@simplewebauthn/browser (source)
^13.0.0 -> ^13.1.2
โฆ
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
twitter patch by dagmawibabi ยท Pull Request #3485 ยท better-auth/b...
Fixed: #3481
This pull request includes a small update to the twitter function in packages/better-auth/src/social-providers/twitter.ts. The change updates the authentication method from "...
Is it intentional to import
createAuthClient
from better-auth/client
rather than better-auth/react
?I'm using SolidJS in my case. I tried
/solid
and /client
and both produce the same outcome.
Also docs seem to specify using /client
Oh, okay then use /client. let me keep digging further
it looks like a monorepo project?
Yeah, this is a monorepo project
Can you test seeing any of the endpoint type definitions for both server & client auth in the same files they're respectively defined in?
For example check that
auth.api.createOrganization
works in auth.ts
and authClient.organization.create
works in the auth-client.ts
fileThe breakdown is the following:
(I've seen cases where there can be missing types when inferred across packages, so just making sure there is nothing wrong with the auth client / auth config itself)
Yeah, so when I inline type within my
auth.ts
module on the server end, I can see TypeScript bring up all the expected interfaces on the organization
object which is good
It's the client side that is missing all the APIsSo even testing in the same file which you defined the
createAuthClient
you can't access any of the org types?Precisely.
Sorry, I meant to say
api
object. So it's auth.api
and all the available Organization APIs are present via TypeScript/Intellisense.If you were to comment out any of the
organizationClient
's passed options, would inference start working for the authClient?Tried that too with just a vanilla
organizationClient()
and still the same outcome.
You can see from above that I even exported the ServerAuth
type and tried to use inferAdditionalFields
to see if that would fix anything. Still no dice.Just testing something as basic as this works on my end:

Could it be related to tsconfig in some way, or a incorrectly installed better-auth dependency?
Let me try that same exact thing.
Look at that weird behavior man


Try removing node_modules and re-installing Better-auth ๐ค
Still the same outcome. I even went ahead and pinned the Better Auth version across all the packages:
I am using Turborepo and have the following
clean
script:
Each of the packages/apps clean
scripts are the following:
I also nuked my bun.lock
after cleaning to regenerate it after re-installing everything. Still the same outcome.Okay this is really werid, maybe there is some tsconfig value causing this. Could you sure your tsconfig?
FYI, I'm not sure what's going on here, so we'll have to debug this ๐
I just appreciate you being available to help. I normally try to be self-sufficient but this issue is making me pull my hair out cause I believe I'm doing everything right.
I have the following
root
tsconfig:
Do you require
exactOptionalPropertyTypes
?I can do without that. I'm fine with removing stuff
I've seen issues with Better-Auth with this config flag in the past, so it could be related, though doubtful
Got rid of it, no changes on the problem
Do you have a public repo I check this out?
Yeah, let me just push up the changes
GitHub
GitHub - thedanchez/dm-poc
Contribute to thedanchez/dm-poc development by creating an account on GitHub.
Try hitting that. I'm using Bun + Turborepo, so you should be able to do a
bun install
to get everything
Just search for auth-client
in the web
package under the apps
directoryAwesome, will check it out now

Really grateful. I'm curious if your machine will produce a different result
Same issue, ๐
Ah, so you're getting it there too
I'll let you know if I find anything
Glad I'm not crazy haha
Maybe this will be a good issue to document once we find the root cause here
I removed the
extends
from tsconfig and it was fixed
There is a config value in there, maybe I can find itIncredible. Would not have expected a TSConfig value to have such a huge impact
It was
exactOptionalPropertyTypes
๐คฃ
Try to add exactOptionalPropertyTypes: false
and it should be fixed
Yeah ๐
WOW!!
Yeah, this is definitely worth documenting
My God...
We hope to fix this in the future in the first place haha, but yeah I understand
Glad it could be solved :)
Thank you for spending the time debugging this with me
Holy crap this was painful
thanks for the thread i had this problem too. not the first time
exactOptionalPropertyTypes
has come up as causing issues though