diff --git a/packages/features/credentials/handleDeleteCredential.ts b/packages/features/credentials/handleDeleteCredential.ts index 7e57a7366d..a7739b81d8 100644 --- a/packages/features/credentials/handleDeleteCredential.ts +++ b/packages/features/credentials/handleDeleteCredential.ts @@ -390,18 +390,19 @@ const handleDeleteCredential = async ({ } } - // if zapier get disconnected, delete zapier apiKey, delete zapier webhooks and cancel all scheduled jobs from zapier - if (credential.app?.slug === "zapier") { + // if zapier or make get disconnected, delete its apiKey, delete its webhooks and cancel all scheduled jobs + if (credential.app?.slug === "zapier" || credential.app?.slug === "make") { + const ownerFilter = teamId ? { teamId } : { userId }; await prisma.apiKey.deleteMany({ where: { - userId: userId, - appId: "zapier", + ...ownerFilter, + appId: credential.app.slug, }, }); await prisma.webhook.deleteMany({ where: { - userId: userId, - appId: "zapier", + ...ownerFilter, + appId: credential.app.slug, }, });