@@ -12,10 +12,7 @@ import { WebhookAttachmentProcessor } from '@/lib/webhooks/attachment-processor'
1212import { fetchAndProcessAirtablePayloads , formatWebhookInput } from '@/lib/webhooks/utils.server'
1313import { executeWorkflowCore } from '@/lib/workflows/executor/execution-core'
1414import { PauseResumeManager } from '@/lib/workflows/executor/human-in-the-loop-manager'
15- import {
16- loadDeployedWorkflowState ,
17- loadWorkflowFromNormalizedTables ,
18- } from '@/lib/workflows/persistence/utils'
15+ import { loadDeployedWorkflowState } from '@/lib/workflows/persistence/utils'
1916import { getWorkflowById } from '@/lib/workflows/utils'
2017import { ExecutionSnapshot } from '@/executor/execution/snapshot'
2118import type { ExecutionMetadata } from '@/executor/execution/types'
@@ -90,7 +87,6 @@ export type WebhookExecutionPayload = {
9087 headers : Record < string , string >
9188 path : string
9289 blockId ?: string
93- executionTarget ?: 'deployed' | 'live'
9490 credentialId ?: string
9591 credentialAccountUserId ?: string
9692}
@@ -141,20 +137,16 @@ async function executeWebhookJobInternal(
141137 let deploymentVersionId : string | undefined
142138
143139 try {
144- const useDraftState = payload . executionTarget === 'live'
145- const workflowData = useDraftState
146- ? await loadWorkflowFromNormalizedTables ( payload . workflowId )
147- : await loadDeployedWorkflowState ( payload . workflowId )
140+ const workflowData = await loadDeployedWorkflowState ( payload . workflowId )
148141 if ( ! workflowData ) {
149142 throw new Error (
150- ` Workflow state not found. The workflow may not be ${ useDraftState ? 'saved' : ' deployed' } or the deployment data may be corrupted.`
143+ ' Workflow state not found. The workflow may not be deployed or the deployment data may be corrupted.'
151144 )
152145 }
153146
154147 const { blocks, edges, loops, parallels } = workflowData
155- // Only deployed executions have a deployment version ID
156148 deploymentVersionId =
157- ! useDraftState && 'deploymentVersionId' in workflowData
149+ 'deploymentVersionId' in workflowData
158150 ? ( workflowData . deploymentVersionId as string )
159151 : undefined
160152
@@ -303,7 +295,6 @@ async function executeWebhookJobInternal(
303295 variables : { } ,
304296 triggerData : {
305297 isTest : false ,
306- executionTarget : payload . executionTarget || 'deployed' ,
307298 } ,
308299 deploymentVersionId,
309300 } )
@@ -361,7 +352,6 @@ async function executeWebhookJobInternal(
361352 variables : { } ,
362353 triggerData : {
363354 isTest : false ,
364- executionTarget : payload . executionTarget || 'deployed' ,
365355 } ,
366356 deploymentVersionId,
367357 } )
@@ -580,7 +570,6 @@ async function executeWebhookJobInternal(
580570 variables : { } ,
581571 triggerData : {
582572 isTest : false ,
583- executionTarget : payload . executionTarget || 'deployed' ,
584573 } ,
585574 deploymentVersionId,
586575 } )
0 commit comments