Stripe Plugin Type Error

Hi everyone! I tried setting up the Stripe plugin using the official guide. My project is configured with: * "type": "module" in package.json * "module": "nodenext" in tsconfig.json With this setup, I’m running into the following type error:
Type '{ id: "stripe"; endpoints: { stripeWebhook: { <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({ body?: undefined; } & { method?: "POST" | undefined; } & { query?: Record<string, any> | undefined; } & ... 4 more ... & { ...; }) | undefined): Promise<...>; options: { ...; } & ...' is not assignable to type 'BetterAuthPlugin'.
Types of property 'init' are incompatible.
Type '(ctx: AuthContext) => { options: { databaseHooks: { user: { create: { after(user: { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | ... 1 more ... | undefined; } & Record<...>, ctx: GenericEndpointContext | undefined): Promise<...>; }; }; }; }; }' is not assignable to type '(ctx: AuthContext) => void | { context?: { appName?: string | undefined; baseURL?: string | undefined; secret?: string | undefined; secondaryStorage?: { get?: ((key: string) => unknown) | undefined; set?: ((key: string, value: string, ttl?: number | undefined) => void | Promise<...>) | undefined; delete?: ((key: str...'.
Types of parameters 'ctx' and 'ctx' are incompatible.
...
Type '{ id: "stripe"; endpoints: { stripeWebhook: { <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({ body?: undefined; } & { method?: "POST" | undefined; } & { query?: Record<string, any> | undefined; } & ... 4 more ... & { ...; }) | undefined): Promise<...>; options: { ...; } & ...' is not assignable to type 'BetterAuthPlugin'.
Types of property 'init' are incompatible.
Type '(ctx: AuthContext) => { options: { databaseHooks: { user: { create: { after(user: { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | ... 1 more ... | undefined; } & Record<...>, ctx: GenericEndpointContext | undefined): Promise<...>; }; }; }; }; }' is not assignable to type '(ctx: AuthContext) => void | { context?: { appName?: string | undefined; baseURL?: string | undefined; secret?: string | undefined; secondaryStorage?: { get?: ((key: string) => unknown) | undefined; set?: ((key: string, value: string, ttl?: number | undefined) => void | Promise<...>) | undefined; delete?: ((key: str...'.
Types of parameters 'ctx' and 'ctx' are incompatible.
...
I came across this related issue: https://github.com/better-auth/better-auth/issues/4054. The version mentioned there, 1.3.8-beta.6, actually resolves the error for me. However, upgrading to the latest version (1.3.18) brings the type issue back. I ensured both better-auth and @better-auth/stripe are installed with the same version. Here is a minimal StackBlitz showing the issue: https://stackblitz.com/edit/stackblitz-starters-q2b7h9pb?file=index.ts
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?