diff --git a/apps/web/lib/api/customers/get-customer-or-throw.ts b/apps/web/lib/api/customers/get-customer-or-throw.ts index 72058b253b..d5026ad732 100644 --- a/apps/web/lib/api/customers/get-customer-or-throw.ts +++ b/apps/web/lib/api/customers/get-customer-or-throw.ts @@ -9,7 +9,16 @@ export const getCustomerOrThrow = async ({ workspaceId: string; }) => { const customer = await prisma.customer.findUnique({ - where: { id }, + where: { + ...(id.startsWith("ext_") + ? { + projectId_externalId: { + projectId: workspaceId, + externalId: id.replace("ext_", ""), + }, + } + : { id }), + }, }); if (!customer || customer.projectId !== workspaceId) {