diff --git a/packages/cli/src/services/dynamic-node-parameters.service.ts b/packages/cli/src/services/dynamic-node-parameters.service.ts index d3575f5bc9..8a5092866e 100644 --- a/packages/cli/src/services/dynamic-node-parameters.service.ts +++ b/packages/cli/src/services/dynamic-node-parameters.service.ts @@ -299,7 +299,10 @@ export class DynamicNodeParametersService { return new LoadOptionsContext(workflow, node, additionalData, path); } - private getLocalLoadOptionsContext(path: string, additionalData: IWorkflowExecuteAdditionalData) { + private getLocalLoadOptionsContext( + path: string, + additionalData: IWorkflowExecuteAdditionalData, + ): ILocalLoadOptionsFunctions { return new LocalLoadOptionsContext( this.nodeTypes, additionalData, diff --git a/packages/core/src/node-execution-context/local-load-options-context.ts b/packages/core/src/node-execution-context/local-load-options-context.ts index 284539c1f6..37e5b09bf3 100644 --- a/packages/core/src/node-execution-context/local-load-options-context.ts +++ b/packages/core/src/node-execution-context/local-load-options-context.ts @@ -26,25 +26,29 @@ export class LocalLoadOptionsContext implements ILocalLoadOptionsFunctions { const workflowId = value as string; if (!workflowId) { - throw new ApplicationError('No workflowId parameter defined on node!'); + throw new ApplicationError(`No workflowId parameter defined on node of type "${nodeType}"!`); } const dbWorkflow = await this.workflowLoader.get(workflowId); - const workflowNode = dbWorkflow.nodes.find((node) => node.type === nodeType) as INode; + const selectedWorkflowNode = dbWorkflow.nodes.find((node) => node.type === nodeType) as INode; - if (workflowNode) { - const workflow = new Workflow({ - nodes: [workflowNode], + if (selectedWorkflowNode) { + const selectedSingleNodeWorkflow = new Workflow({ + nodes: [selectedWorkflowNode], connections: {}, active: false, nodeTypes: this.nodeTypes, }); - const workflowAdditionalData = deepCopy(this.additionalData); - workflowAdditionalData.currentNodeParameters = workflowNode.parameters; + const workflowAdditionalData = { ...this.additionalData }; + workflowAdditionalData.currentNodeParameters = selectedWorkflowNode.parameters; - return new LoadWorkflowNodeContext(workflow, workflowNode, workflowAdditionalData); + return new LoadWorkflowNodeContext( + selectedSingleNodeWorkflow, + selectedWorkflowNode, + workflowAdditionalData, + ); } return null;