Skip to content

Commit 0d8d9fb

Browse files
fix(type): logs workspace delivery (#3063)
1 parent e0f1e66 commit 0d8d9fb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

apps/sim/background/workspace-notification-delivery.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ function generateSignature(secret: string, timestamp: number, body: string): str
6666
async function buildPayload(
6767
log: WorkflowExecutionLog,
6868
subscription: typeof workspaceNotificationSubscription.$inferSelect
69-
): Promise<NotificationPayload> {
69+
): Promise<NotificationPayload | null> {
70+
// Skip notifications for deleted workflows
71+
if (!log.workflowId) return null
72+
7073
const workflowData = await db
7174
.select({ name: workflowTable.name, userId: workflowTable.userId })
7275
.from(workflowTable)
@@ -526,6 +529,13 @@ export async function executeNotificationDelivery(params: NotificationDeliveryPa
526529
const attempts = claimed[0].attempts
527530
const payload = await buildPayload(log, subscription)
528531

532+
// Skip delivery for deleted workflows
533+
if (!payload) {
534+
await updateDeliveryStatus(deliveryId, 'failed', 'Workflow was deleted')
535+
logger.info(`Skipping delivery ${deliveryId} - workflow was deleted`)
536+
return
537+
}
538+
529539
let result: { success: boolean; status?: number; error?: string }
530540

531541
switch (notificationType) {

0 commit comments

Comments
 (0)