routes return null

I'm using better-auth with fastify and all my auth routes are returning only "null" on the body. i'm kinda lost here trying to debug the reason. (yeah tried ask llms but even them can't help much)
// auth.ts
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { db } from "../utils/db";
import {
  user as userTable,
  account as accountTable,
  session as sessionTable,
  verification as verificationTable,
} from "../database/schema/index";
import dotenv from "dotenv";
dotenv.config();

export const auth = betterAuth({
  baseURL: process.env.BASE_URL || "http://localhost:3000/api/v1",
  trustedOrigins: [process.env.CLIENT_ORIGIN || "http://localhost:3000/api/v1"],
  secret: process.env.BETTER_AUTH_SECRET || "secret",
  emailAndPassword: {
    enabled: true,
  },
  socialProviders: {
    google: {
      clientId: process.env.GOOGLE_CLIENT_ID as string,
      clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
    },
  },
  advanced: {
    cookiePrefix: "chatstore_",
  },
  database: drizzleAdapter(db, {
    provider: "pg",
    schema: {
      user: userTable,
      account: accountTable,
      session: sessionTable,
      verification: verificationTable,
    },
  }),
  logger: {
    level: process.env.NODE_ENV === "development" ? "debug" : "info",
  },
  customIdGenerator: true,
});
Was this page helpful?