Type error: Property 'getFullOrganization' does not exist on type 'InferAPI

I added the organization plugin to my auth.ts and to the client. On the client, it works perfectly, and on the server as well, but I can't make a request on the server without getting a type error.

Type error: Property 'getFullOrganization' does not exist on type 'InferAPI<{ ok: { <C extends [(better_call.Context<"/ok", { method: "GET"; metadata: { openapi: { description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { ok: { type: string; }; }; }; }; }; }; }; }; isAction: false; }; }> | undefined)?]>(...'.
`

in my auth.ts:
`
import { betterAuth } from 'better-auth';
import { drizzleAdapter } from 'better-auth/adapters/drizzle';
import {
  organization,
  twoFactor,
} from 'better-auth/plugins';

type AuthReturnType = ReturnType<typeof betterAuth>;

export const auth: AuthReturnType = betterAuth({
  databaseHooks: {
    user: {
      create: {
        after: async (user) => {
          await createDefaultOrganization({ user });
        },
      },
    },
    session: {
      create: {
        before: async (session) => {
          const org = await getDefaultOrganization(session.userId);
          return {
            data: {
              ...session,
              activeOrganizationId: org?.id,
            },
          };
        },
      },
    },
  },
  appName: process.env.APP_NAME,
  plugins: [
    organization(),
    twoFactor(...),

  ],
});
`

in my layout:
  const initialActiveOrganization = await auth.api.getFullOrganization({
    headers: await headers(),
  });
`

any idea?
Was this page helpful?