Skip to content

createAuthMutations type error when using convexClient() plugin with better-auth 1.6.x #243

@m7md1alaa

Description

@m7md1alaa

createAuthMutations(authClient) throws a TypeScript error when the auth client includes the convexClient() plugin (from kitcn/auth/client). The issue also occurs with the convexClient() from @convex-dev/better-auth/client/plugins.
Error

src/lib/auth-client.ts(25,25): error TS2345: Argument of type '...' is not assignable to parameter of type 'AuthClient'.
  Types of property 'getSession' are incompatible.
    Type '<FetchOptions extends ClientFetchOption<never, ...>>(...) => Promise<...>' is not assignable to type 'AnyFn'.
      Types of parameters 'data_0' and 'args' are incompatible.
        Type 'unknown' is not assignable to type 'Prettify<{ query?: ... }>'.

better-auth 1.6.x , i think the latest one which is 1.6.9
changed getSession's signature to use constrained generic parameters (see get-convex/better-auth#323 , Specifically, shouldReturnResponse now defaults to true when ctx.request instanceof Request, and getSession gained typed query/fetch options with disableCookieCache and disableRefresh params.

Environment

  • better-auth: ^1.6.9
  • @convex-dev/better-auth: ^0.12.0
  • kitcn: ^0.13.9

anyone want workaround , u can just

createAuthMutations(authClient as any)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions