diff --git a/sim/app/api/webhooks/trigger/[path]/route.ts b/sim/app/api/webhooks/trigger/[path]/route.ts index 444011859f..ab16d2c91a 100644 --- a/sim/app/api/webhooks/trigger/[path]/route.ts +++ b/sim/app/api/webhooks/trigger/[path]/route.ts @@ -314,6 +314,13 @@ export async function POST( } })(); + // Store reference to processing task to prevent garbage collection + const taskId = `${requestId}:${Date.now()}`; + activeProcessingTasks.set(taskId, processingPromise.finally(() => { + logger.info(`[${requestId}] Processing complete, removing from active tasks`); + activeProcessingTasks.delete(taskId); + })); + // Race processing against timeout to ensure fast response return Promise.race([timeoutPromise, processingPromise]); }