Expo plugin isn't a valid plugin

Just set up an external backend for my app and for some reason the expo plugin from import { expo } from "@better-auth/expo"; isnt compatible with the type BetterAuthPlugin. Error:
Type '{ id: "expo"; init: (ctx: AuthContext) => { options: { trustedOrigins: string[]; }; }; onRequest(request: Request, ctx: AuthContext): Promise<{ request: Request; } | undefined>; hooks: { ...; }; }' is not assignable to type 'BetterAuthPlugin'.
Types of property 'init' are incompatible.
Type '(ctx: AuthContext) => { options: { trustedOrigins: string[]; }; }' is not assignable to type '(ctx: AuthContext) => void | { context?: { trustedOrigins?: (string | undefined)[] | undefined; appName?: string | undefined; baseURL?: string | undefined; newSession?: { ...; } | ... 1 more ... | undefined; ... 15 more ...; runMigrations?: (() => Promise<...>) | undefined; } | undefined; options?: Partial<...> | un...'.
Types of parameters 'ctx' and 'ctx' are incompatible.
Type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.qzSbzJNO", { with: { "resolution-mode": "import" } }).l' is not assignable to type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.B3qlboSE").l'.
The types of 'options.socialProviders' are incompatible between these types.
Type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DNTAFSt1", { with: { "resolution-mode": "import" } }).S | undefined' is not assignable to type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").S | undefined'.
Type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DNTAFSt1", { with: { "resolution-mode": "import" } }).S' is not assignable to type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").S'.
Types of property 'vk' are incompatible.
Type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.CYegVoq1", { with: { "resolution-mode": "import" } }).P<import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DNTAFSt1", { with: { "resolution-mode": "import" } }).a4 & { ...' is not assignable to type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.CYegVoq1").P<import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").a4 & { ...'.
Type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.CYegVoq1", { with: { "resolution-mode": "import" } }).P<import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DNTAFSt1", { with: { "resolution-mode": "import" } }).a4 & { ...' is not assignable to type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.CYegVoq1").P<import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").a4 & { ...'.
Types of property 'lang_id' are incompatible.
Type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DNTAFSt1", { with: { "resolution-mode": "import" } }).a3 | undefined' is not assignable to type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").a3 | undefined'.
Type 'LANG.RUS' is not assignable to type 'LANG | undefined'.
Type '{ id: "expo"; init: (ctx: AuthContext) => { options: { trustedOrigins: string[]; }; }; onRequest(request: Request, ctx: AuthContext): Promise<{ request: Request; } | undefined>; hooks: { ...; }; }' is not assignable to type 'BetterAuthPlugin'.
Types of property 'init' are incompatible.
Type '(ctx: AuthContext) => { options: { trustedOrigins: string[]; }; }' is not assignable to type '(ctx: AuthContext) => void | { context?: { trustedOrigins?: (string | undefined)[] | undefined; appName?: string | undefined; baseURL?: string | undefined; newSession?: { ...; } | ... 1 more ... | undefined; ... 15 more ...; runMigrations?: (() => Promise<...>) | undefined; } | undefined; options?: Partial<...> | un...'.
Types of parameters 'ctx' and 'ctx' are incompatible.
Type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.qzSbzJNO", { with: { "resolution-mode": "import" } }).l' is not assignable to type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.B3qlboSE").l'.
The types of 'options.socialProviders' are incompatible between these types.
Type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DNTAFSt1", { with: { "resolution-mode": "import" } }).S | undefined' is not assignable to type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").S | undefined'.
Type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DNTAFSt1", { with: { "resolution-mode": "import" } }).S' is not assignable to type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").S'.
Types of property 'vk' are incompatible.
Type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.CYegVoq1", { with: { "resolution-mode": "import" } }).P<import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DNTAFSt1", { with: { "resolution-mode": "import" } }).a4 & { ...' is not assignable to type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.CYegVoq1").P<import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").a4 & { ...'.
Type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.CYegVoq1", { with: { "resolution-mode": "import" } }).P<import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DNTAFSt1", { with: { "resolution-mode": "import" } }).a4 & { ...' is not assignable to type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.CYegVoq1").P<import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").a4 & { ...'.
Types of property 'lang_id' are incompatible.
Type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DNTAFSt1", { with: { "resolution-mode": "import" } }).a3 | undefined' is not assignable to type 'import("<project-root>/node_modules/.pnpm/better-auth@1.2.7/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").a3 | undefined'.
Type 'LANG.RUS' is not assignable to type 'LANG | undefined'.
12 Replies
Dominik
DominikOP5mo ago
with this config:
export const auth = betterAuth({
trustedOrigins: ["myapp://"],
plugins: [expo()],
database: prismaAdapter(prisma, {
provider: "postgresql",
}),
emailAndPassword: {
enabled: true,
},
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
},
apple: {
clientId: process.env.APPLE_CLIENT_ID!,
clientSecret: process.env.APPLE_CLIENT_SECRET!,
//appBundleIdentifier: process.env.APPLE_APP_BUNDLE_IDENTIFIER!,
},
facebook: {
clientId: process.env.FACEBOOK_CLIENT_ID!,
clientSecret: process.env.FACEBOOK_CLIENT_SECRET!,
},
},
});
export const auth = betterAuth({
trustedOrigins: ["myapp://"],
plugins: [expo()],
database: prismaAdapter(prisma, {
provider: "postgresql",
}),
emailAndPassword: {
enabled: true,
},
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
},
apple: {
clientId: process.env.APPLE_CLIENT_ID!,
clientSecret: process.env.APPLE_CLIENT_SECRET!,
//appBundleIdentifier: process.env.APPLE_APP_BUNDLE_IDENTIFIER!,
},
facebook: {
clientId: process.env.FACEBOOK_CLIENT_ID!,
clientSecret: process.env.FACEBOOK_CLIENT_SECRET!,
},
},
});
Ping
Ping5mo ago
Make sure both the expo and better-auth are up-to-date. @Dominik
Dominik
DominikOP5mo ago
They are both on 1.2.7, I think thats the newest version Yea just checked the github seems like it I also just reinstalled my packages still doesnt seem to be working
Ping
Ping5mo ago
how about refreshing ts-server?
Dominik
DominikOP5mo ago
Done that too same thing somehow Anyone got any idea?
Thorlon
Thorlon5mo ago
Have you tried a fresh project and maybe a different package manager? Worth a shot Also could you give us your package.json file, or any other information about your setup?
Dominik
DominikOP5mo ago
its basically a brand new project only has the expo plugin in it As for the package file its basically just this
{
"name": "backend",
"type": "module",
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "tsc",
"postinstall": "prisma generate"
},
"dependencies": {
"@better-auth/expo": "^1.2.7",
"@hono/node-server": "^1.14.1",
"@prisma/client": "^6.6.0",
"better-auth": "^1.2.7",
"dotenv": "^16.5.0",
"hono": "^4.7.7",
"prisma": "^6.6.0"
},
"devDependencies": {
"@types/node": "^20.11.17",
"tsx": "^4.7.1",
"typescript": "^5.8.3"
},
"packageManager": "pnpm@9.15.1"
}
{
"name": "backend",
"type": "module",
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "tsc",
"postinstall": "prisma generate"
},
"dependencies": {
"@better-auth/expo": "^1.2.7",
"@hono/node-server": "^1.14.1",
"@prisma/client": "^6.6.0",
"better-auth": "^1.2.7",
"dotenv": "^16.5.0",
"hono": "^4.7.7",
"prisma": "^6.6.0"
},
"devDependencies": {
"@types/node": "^20.11.17",
"tsx": "^4.7.1",
"typescript": "^5.8.3"
},
"packageManager": "pnpm@9.15.1"
}
Lapis
Lapis5mo ago
maybe try a different package manager
regex
regex5mo ago
hey Dominik, were you able to solve this? @Dominik
Dominik
DominikOP5mo ago
No there is an open issue on github tho
regex
regex5mo ago
could you link me the issue?
Dominik
DominikOP5mo ago
GitHub
Expo plugin is not assignable to type 'BetterAuthPlugin' · Issue #...
Is this suited for github? Yes, this is suited for github To Reproduce Following the guide for expo integration, there is a type error import { serve } from '@hono/node-server' import { Hon...

Did you find this page helpful?