© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago•
3 replies
Philipp Nowinski

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." };
  }
}
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
eq
:

Any idea what I'm missing here?
image.png
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Type error when using subquery in where
Drizzle TeamDTDrizzle Team / help
2y ago
Using extras in where
Drizzle TeamDTDrizzle Team / help
2y ago
where clause when using 'with' in relational mode
Drizzle TeamDTDrizzle Team / help
2y ago
Drizzle-zod typeerror when passing in pgtable
Drizzle TeamDTDrizzle Team / help
2y ago