Session cookie not being created

As title states, I can login using the api fine. The sessions are created in the database. However, no cookies are being made and thus the sessions always result in null.

I tried experimenting with subdomain cookies where the behaviour first started, but now I can't get the cookies to create at all anymore in any browser.

I don't have anything special in the auth object:
import { betterAuth } from "better-auth";
import { admin, organization } from "better-auth/plugins";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { db } from "~/lib/database/db.server";
import { env } from "~/lib/env.server";
import * as schema from "~/lib/database/schema";

console.log(process.env.BASE_URL, env.APP_SUB_DOMAIN, env.PUBLIC_ROOT_DOMAIN);

export const auth = betterAuth({
  baseURL: process.env.BASE_URL, //http://localhost:5173
  secret: env.BETTER_AUTH_SECRET,
  database: drizzleAdapter(db, {
    provider: env.DB_TYPE.toLowerCase() as "pg" | "mysql" | "sqlite", //sqlite
    schema: schema,
  }),
  emailAndPassword: {
    enabled: true,
    autoSignIn: true,
    requireEmailVerification: false,
    sendResetPassword: async ({ user, url, token }) => {
      if (process.env.NODE_ENV === "development") {
        console.log("Send email to reset password");
        console.log(user, url, token);
      } else {
        // Send email
      }
    },
  },
  user: {
    deleteUser: {
      enabled: true,
    },
  },
  plugins: [admin(), organization()],
});

And I'm quite stumped. It worked for a second, I don't think I change anything and now it refuses to do anything cookie related.

EDIT: forgot to mention this is in development on localhost
Was this page helpful?