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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").S | undefined'.
Type 'import("<project-root>/node_modules/.pnpm/[email protected]/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/[email protected]/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").S'.
Types of property 'vk' are incompatible.
Type 'import("<project-root>/node_modules/.pnpm/[email protected]/node_modules/better-auth/dist/shared/better-auth.CYegVoq1", { with: { "resolution-mode": "import" } }).P<import("<project-root>/node_modules/.pnpm/[email protected]/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/[email protected]/node_modules/better-auth/dist/shared/better-auth.CYegVoq1").P<import("<project-root>/node_modules/.pnpm/[email protected]/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").a4 & { ...'.
Type 'import("<project-root>/node_modules/.pnpm/[email protected]/node_modules/better-auth/dist/shared/better-auth.CYegVoq1", { with: { "resolution-mode": "import" } }).P<import("<project-root>/node_modules/.pnpm/[email protected]/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/[email protected]/node_modules/better-auth/dist/shared/better-auth.CYegVoq1").P<import("<project-root>/node_modules/.pnpm/[email protected]/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").a4 & { ...'.
Types of property 'lang_id' are incompatible.
Type 'import("<project-root>/node_modules/.pnpm/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").S | undefined'.
Type 'import("<project-root>/node_modules/.pnpm/[email protected]/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/[email protected]/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").S'.
Types of property 'vk' are incompatible.
Type 'import("<project-root>/node_modules/.pnpm/[email protected]/node_modules/better-auth/dist/shared/better-auth.CYegVoq1", { with: { "resolution-mode": "import" } }).P<import("<project-root>/node_modules/.pnpm/[email protected]/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/[email protected]/node_modules/better-auth/dist/shared/better-auth.CYegVoq1").P<import("<project-root>/node_modules/.pnpm/[email protected]/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").a4 & { ...'.
Type 'import("<project-root>/node_modules/.pnpm/[email protected]/node_modules/better-auth/dist/shared/better-auth.CYegVoq1", { with: { "resolution-mode": "import" } }).P<import("<project-root>/node_modules/.pnpm/[email protected]/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/[email protected]/node_modules/better-auth/dist/shared/better-auth.CYegVoq1").P<import("<project-root>/node_modules/.pnpm/[email protected]/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").a4 & { ...'.
Types of property 'lang_id' are incompatible.
Type 'import("<project-root>/node_modules/.pnpm/[email protected]/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/[email protected]/node_modules/better-auth/dist/shared/better-auth.DTiSPWEk").a3 | undefined'.
Type 'LANG.RUS' is not assignable to type 'LANG | undefined'.
7 Replies
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!,
},
},
});
Make sure both the expo and better-auth are up-to-date. @Dominik
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
how about refreshing ts-server?
Done that too same thing somehow
Anyone got any idea?
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?
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": "[email protected]"
}
{
"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": "[email protected]"
}