Skip to content

Commit 3838b6e

Browse files
authored
v0.6.41: webhooks fix, workers removal
2 parents 0ac0539 + a51333a commit 3838b6e

File tree

1 file changed

+40
-44
lines changed

1 file changed

+40
-44
lines changed

apps/sim/lib/webhooks/processor.ts

Lines changed: 40 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -591,32 +591,30 @@ export async function queueWebhookExecution(
591591
`[${options.requestId}] Queued ${foundWebhook.provider} webhook execution ${jobId} via inline backend`
592592
)
593593

594-
if (shouldExecuteInline()) {
595-
void (async () => {
594+
void (async () => {
595+
try {
596+
await jobQueue.startJob(jobId)
597+
const output = await executeWebhookJob(payload)
598+
await jobQueue.completeJob(jobId, output)
599+
} catch (error) {
600+
const errorMessage = error instanceof Error ? error.message : String(error)
601+
logger.error(`[${options.requestId}] Webhook execution failed`, {
602+
jobId,
603+
error: errorMessage,
604+
})
596605
try {
597-
await jobQueue.startJob(jobId)
598-
const output = await executeWebhookJob(payload)
599-
await jobQueue.completeJob(jobId, output)
600-
} catch (error) {
601-
const errorMessage = error instanceof Error ? error.message : String(error)
602-
logger.error(`[${options.requestId}] Webhook execution failed`, {
606+
await jobQueue.markJobFailed(jobId, errorMessage)
607+
} catch (markFailedError) {
608+
logger.error(`[${options.requestId}] Failed to mark job as failed`, {
603609
jobId,
604-
error: errorMessage,
610+
error:
611+
markFailedError instanceof Error
612+
? markFailedError.message
613+
: String(markFailedError),
605614
})
606-
try {
607-
await jobQueue.markJobFailed(jobId, errorMessage)
608-
} catch (markFailedError) {
609-
logger.error(`[${options.requestId}] Failed to mark job as failed`, {
610-
jobId,
611-
error:
612-
markFailedError instanceof Error
613-
? markFailedError.message
614-
: String(markFailedError),
615-
})
616-
}
617615
}
618-
})()
619-
}
616+
}
617+
})()
620618
}
621619

622620
const successResponse = handler.formatSuccessResponse?.(providerConfig) ?? null
@@ -780,32 +778,30 @@ export async function processPolledWebhookEvent(
780778
})
781779
logger.info(`[${requestId}] Queued ${provider} webhook execution ${jobId} via inline backend`)
782780

783-
if (shouldExecuteInline()) {
784-
void (async () => {
781+
void (async () => {
782+
try {
783+
await jobQueue.startJob(jobId)
784+
const output = await executeWebhookJob(payload)
785+
await jobQueue.completeJob(jobId, output)
786+
} catch (error) {
787+
const errorMessage = error instanceof Error ? error.message : String(error)
788+
logger.error(`[${requestId}] Webhook execution failed`, {
789+
jobId,
790+
error: errorMessage,
791+
})
785792
try {
786-
await jobQueue.startJob(jobId)
787-
const output = await executeWebhookJob(payload)
788-
await jobQueue.completeJob(jobId, output)
789-
} catch (error) {
790-
const errorMessage = error instanceof Error ? error.message : String(error)
791-
logger.error(`[${requestId}] Webhook execution failed`, {
793+
await jobQueue.markJobFailed(jobId, errorMessage)
794+
} catch (markFailedError) {
795+
logger.error(`[${requestId}] Failed to mark job as failed`, {
792796
jobId,
793-
error: errorMessage,
797+
error:
798+
markFailedError instanceof Error
799+
? markFailedError.message
800+
: String(markFailedError),
794801
})
795-
try {
796-
await jobQueue.markJobFailed(jobId, errorMessage)
797-
} catch (markFailedError) {
798-
logger.error(`[${requestId}] Failed to mark job as failed`, {
799-
jobId,
800-
error:
801-
markFailedError instanceof Error
802-
? markFailedError.message
803-
: String(markFailedError),
804-
})
805-
}
806802
}
807-
})()
808-
}
803+
}
804+
})()
809805
}
810806

811807
return { success: true }

0 commit comments

Comments
 (0)