File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
apps/sim/app/api/workflows/[id]/deploy Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff 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 (
You can’t perform that action at this time.
0 commit comments