From 7ea78b0f155ce6c10143dceebda2ad6ea43ed91a Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Wed, 28 Jan 2026 19:48:18 -0800 Subject: [PATCH] fix(type): logs workspace delivery --- .../background/workspace-notification-delivery.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/sim/background/workspace-notification-delivery.ts b/apps/sim/background/workspace-notification-delivery.ts index aad39eea2..d5dbf3a92 100644 --- a/apps/sim/background/workspace-notification-delivery.ts +++ b/apps/sim/background/workspace-notification-delivery.ts @@ -66,7 +66,10 @@ function generateSignature(secret: string, timestamp: number, body: string): str async function buildPayload( log: WorkflowExecutionLog, subscription: typeof workspaceNotificationSubscription.$inferSelect -): Promise { +): Promise { + // Skip notifications for deleted workflows + if (!log.workflowId) return null + const workflowData = await db .select({ name: workflowTable.name, userId: workflowTable.userId }) .from(workflowTable) @@ -526,6 +529,13 @@ export async function executeNotificationDelivery(params: NotificationDeliveryPa const attempts = claimed[0].attempts const payload = await buildPayload(log, subscription) + // Skip delivery for deleted workflows + if (!payload) { + await updateDeliveryStatus(deliveryId, 'failed', 'Workflow was deleted') + logger.info(`Skipping delivery ${deliveryId} - workflow was deleted`) + return + } + let result: { success: boolean; status?: number; error?: string } switch (notificationType) {