Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(webhook): stop dropping webhook events merged during an active run

Calvin0f87e0565dee
diff --git a/backend/src/services/secret/secret-queue.ts b/backend/src/services/secret/secret-queue.ts
index 3d7f33dff4..6d896cdd7c 100644
--- a/backend/src/services/secret/secret-queue.ts
+++ b/backend/src/services/secret/secret-queue.ts
@@ -701,7 +701,6 @@ export const secretQueueFactory = ({
}
},
{
- jobId: `secret-webhook-${environment}-${projectId}-${secretPath}`,
removeOnFail: { count: 5 },
removeOnComplete: true,
delay: 1000,
@@ -709,6 +708,14 @@ export const secretQueueFactory = ({
backoff: {
type: "exponential",
delay: 3000
+ },
+ // A plain jobId dedupes only while the previous job is queued/delayed: BullMQ silently drops an
+ // add() that collides with an *active* job, so a secret change merged mid-webhook-call never fired.
+ // keepLastIfActive stores that add and replays it once the active job finishes instead of dropping it.
+ deduplication: {
+ id: `secret-webhook-${environment}-${projectId}-${secretPath}`,
+ keepLastIfActive: true,
+ replace: true
}
}
);