Skip to content

Commit 1376793

Browse files
committed
fix: enable workflow validation before deployment
1 parent 4c12914 commit 1376793

File tree

1 file changed

+16
-0
lines changed
  • apps/sim/app/api/workflows/[id]/deploy

1 file changed

+16
-0
lines changed

apps/sim/app/api/workflows/[id]/deploy/route.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,22 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{
134134
return createErrorResponse('Failed to load workflow state', 500)
135135
}
136136

137+
// Validate workflow state before allowing deployment
138+
const { validateWorkflowState } = await import('@/lib/workflows/sanitization/validation')
139+
const stateValidation = validateWorkflowState({
140+
blocks: normalizedData.blocks,
141+
edges: normalizedData.edges,
142+
})
143+
if (!stateValidation.valid) {
144+
logger.warn(
145+
`[${requestId}] Workflow validation failed for ${id}: ${stateValidation.errors.join('; ')}`
146+
)
147+
return createErrorResponse(
148+
`Workflow has validation errors: ${stateValidation.errors.join('; ')}`,
149+
400
150+
)
151+
}
152+
137153
const scheduleValidation = validateWorkflowSchedules(normalizedData.blocks)
138154
if (!scheduleValidation.isValid) {
139155
logger.warn(

0 commit comments

Comments
 (0)