Skip to content

Scheduling infrastructure for absolutely everyone.

fix: delete related api key when make.com app is disconnect (#23539)

Anik Dhabal Babu216fb2141b61
diff --git a/packages/features/credentials/handleDeleteCredential.ts b/packages/features/credentials/handleDeleteCredential.ts
index 7e57a7366dc..a7739b81d86 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,
},
});