t3 turbo - Better Auth plugins causing issue

when using plugins in betterauth it breaks trpc , here is what i got
The inferred type of 'appRouter' cannot be named without a reference to '../../auth/node_modules/better-auth/dist/shared/better-auth.B955zZIT'. This is likely not portable. A type annotation is necessary.

Exported variable 'appRouter' has or is using name 'OAuthProxyOptions' from external module "~/Desktop/Git-Projects/PROJECT/node_modules/.pnpm/better-auth@1.3.27_next@15.5.4_@babel+core@7.28.4_@opentelemetry+api@1.9.0_babel-plugin_980c5e2cfd658cc38be409e61a8bed76/node_modules/better-auth/dist/plugins/oauth-proxy/index" but cannot be named.

The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.
The inferred type of 'appRouter' cannot be named without a reference to '../../auth/node_modules/better-auth/dist/shared/better-auth.B955zZIT'. This is likely not portable. A type annotation is necessary.

Exported variable 'appRouter' has or is using name 'OAuthProxyOptions' from external module "~/Desktop/Git-Projects/PROJECT/node_modules/.pnpm/better-auth@1.3.27_next@15.5.4_@babel+core@7.28.4_@opentelemetry+api@1.9.0_babel-plugin_980c5e2cfd658cc38be409e61a8bed76/node_modules/better-auth/dist/plugins/oauth-proxy/index" but cannot be named.

The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.
just the t3 turbo plugins cause this error
Exported variable 'appRouter' has or is using name 'OAuthProxyOptions' from external module "~/Desktop/Git-Projects/PROJECT/node_modules/.pnpm/better-auth@1.3.27_next@15.5.4_@babel+core@7.28.4_@opentelemetry+api@1.9.0_babel-plugin_980c5e2cfd658cc38be409e61a8bed76/node_modules/better-auth/dist/plugins/oauth-proxy/index" but cannot be named.
Exported variable 'appRouter' has or is using name 'OAuthProxyOptions' from external module "~/Desktop/Git-Projects/PROJECT/node_modules/.pnpm/better-auth@1.3.27_next@15.5.4_@babel+core@7.28.4_@opentelemetry+api@1.9.0_babel-plugin_980c5e2cfd658cc38be409e61a8bed76/node_modules/better-auth/dist/plugins/oauth-proxy/index" but cannot be named.
and removing the user schema additions removes the error
user: {
additionalFields: {
phoneNumber: {
type: "string",
required: true,
input: true,
},
lang: {
type: "string",
required: false,
defaultValue: "ar",
},
loyaltyPoints: {
type: "number",
required: false,
},
address: {
type: "string",
required: false,
},
},
},
user: {
additionalFields: {
phoneNumber: {
type: "string",
required: true,
input: true,
},
lang: {
type: "string",
required: false,
defaultValue: "ar",
},
loyaltyPoints: {
type: "number",
required: false,
},
address: {
type: "string",
required: false,
},
},
},
how can i fix these issues or are they upstream trpc / betterauth issues that aren't due to my trpc incompetence? here is my better auth config https://paste.sh/bBjWAYB3#cF3EFQq1oZ5y7zkne66pGe5E here is what is needed to fix the errors https://paste.sh/2C1JmBqV#sbj1xuEyu92pmlcjev6-86ng can't post it on discord because of char limit
2 Replies
Lukem121
Lukem1214w ago
GitHub
The inferred type of 'auth' cannot be named without a reference · ...
Is this suited for github? Yes, this is suited for github To Reproduce setup better-auth in express node application. Current vs. Expected behavior The inferred type of 'auth' cannot be nam...
DomsoN
DomsoN4w ago
There are two tsconfig options: definition and definitionMap, sth like this. Try to set it to false or remove entirely from tsconfig

Did you find this page helpful?