Skip to content

Open-source status page, incident response and uptime monitoring

hotfix: clerk webhook

mxkaske200db5ab9f90
diff --git a/packages/api/src/router/clerk/webhook.ts b/packages/api/src/router/clerk/webhook.ts
index 479968271..1c8ffbb46 100644
--- a/packages/api/src/router/clerk/webhook.ts
+++ b/packages/api/src/router/clerk/webhook.ts
@@ -1,5 +1,6 @@
import * as z from "zod";
+import { eq } from "@openstatus/db";
import { user, usersToWorkspaces, workspace } from "@openstatus/db/src/schema";
import { createTRPCRouter, publicProcedure } from "../../trpc";
@@ -17,7 +18,8 @@ export const webhookRouter = createTRPCRouter({
// There's no primary key with drizzle I checked the tennant is not already in the database
const alreadyExists = await opts.ctx.db
.select({ id: user.id })
- .from(user);
+ .from(user)
+ .where(eq(user.tenantId, opts.input.data.data.id));
if (alreadyExists.length) return;