Skip to content

Commit fef652e

Browse files
committed
address bugbot comments
1 parent d0b8f1f commit fef652e

File tree

3 files changed

+18
-11
lines changed
  • apps/sim
    • app/api
      • v1/admin/workflows/[id]/versions/[versionId]/activate
      • workflows/[id]/deployments/[version]/activate
    • lib/webhooks

3 files changed

+18
-11
lines changed

apps/sim/app/api/v1/admin/workflows/[id]/versions/[versionId]/activate/route.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ export const POST = withAdminAuthParams<RouteParams>(async (request, context) =>
8585

8686
const workflowData = workflowRecord as Record<string, unknown>
8787

88+
const scheduleValidation = validateWorkflowSchedules(blocks)
89+
if (!scheduleValidation.isValid) {
90+
return badRequestResponse(`Invalid schedule configuration: ${scheduleValidation.error}`)
91+
}
92+
8893
const triggerSaveResult = await saveTriggerWebhooksForDeploy({
8994
request,
9095
workflowId,
@@ -107,11 +112,6 @@ export const POST = withAdminAuthParams<RouteParams>(async (request, context) =>
107112
)
108113
}
109114

110-
const scheduleValidation = validateWorkflowSchedules(blocks)
111-
if (!scheduleValidation.isValid) {
112-
return badRequestResponse(`Invalid schedule configuration: ${scheduleValidation.error}`)
113-
}
114-
115115
const scheduleResult = await createSchedulesForDeploy(workflowId, blocks, db, versionRow.id)
116116

117117
if (!scheduleResult.success) {

apps/sim/app/api/workflows/[id]/deployments/[version]/activate/route.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ export async function POST(
8585
return createErrorResponse('Invalid deployed state structure', 500)
8686
}
8787

88+
const scheduleValidation = validateWorkflowSchedules(blocks)
89+
if (!scheduleValidation.isValid) {
90+
return createErrorResponse(`Invalid schedule configuration: ${scheduleValidation.error}`, 400)
91+
}
92+
8893
const triggerSaveResult = await saveTriggerWebhooksForDeploy({
8994
request,
9095
workflowId: id,
@@ -104,11 +109,6 @@ export async function POST(
104109
)
105110
}
106111

107-
const scheduleValidation = validateWorkflowSchedules(blocks)
108-
if (!scheduleValidation.isValid) {
109-
return createErrorResponse(`Invalid schedule configuration: ${scheduleValidation.error}`, 400)
110-
}
111-
112112
const scheduleResult = await createSchedulesForDeploy(id, blocks, db, versionRow.id)
113113

114114
if (!scheduleResult.success) {

apps/sim/lib/webhooks/deploy.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,14 @@ export async function saveTriggerWebhooksForDeploy({
623623
requestId
624624
)
625625
if (pollingError) {
626-
logger.warn(`[${requestId}] Polling configuration failed for ${sub.block.id}`, pollingError)
626+
logger.error(
627+
`[${requestId}] Polling configuration failed for ${sub.block.id}`,
628+
pollingError
629+
)
630+
for (const block of triggerBlocks) {
631+
;(block as any)._webhookConfig = undefined
632+
}
633+
return { success: false, error: pollingError }
627634
}
628635
}
629636
} catch (error: any) {

0 commit comments

Comments
 (0)