TypeError when using and() in where()

I am trying to update based on two conditions. As far as I understand the docs, this should work, but I am getting a TypeError that I just can't get my head around. The code is even working, but since there is the TypeError, I can't build a production bundle.

Consider this piece of code:

import { db } from ".";
import { apps } from "./schema";
import { auth } from "@clerk/nextjs/server";
import { and, eq } from "drizzle-orm";
import { generateAccessKey } from "~/lib/utils";

export async function resetAccessKeyForApp(appId: string) {
  const user = auth();

  try {
    await db
      .update(apps)
      .set({ accessKey: generateAccessKey() })
      .where(and(eq(apps.id, appId), eq(apps.user, user.userId)));
    return { message: "success" };
  } catch (e) {
    console.log(e);
    return { message: "Failed to reset access key." };
  }
}


See the Screenshot for the TS Errpr. The problematic part seems to be the second eq:

Any idea what I'm missing here?
image.png
Was this page helpful?