Can't enable the username plugin

Hi



import { betterAuth, type BetterAuthOptions } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { getDatabase, schema } from "@/db/connection";
import type { EnvConfigType } from "@/config/env";

import { username } from "better-auth/plugins";

export function createAuth(config: EnvConfigType) {
  return betterAuth({
    database: drizzleAdapter(getDatabase(), { provider: "pg", schema }),
    secret: config.BETTER_AUTH_SECRET,
    baseURL: config.BETTER_AUTH_URL,
    basePath: "/v1/auth",
    trustedOrigins: [config.BETTER_AUTH_URL],
    plugins: [username()],
  });
}
Was this page helpful?