Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/workflow/src/node-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1047,12 +1047,15 @@ export function getNodeOutputs(
} else {
// Calculate the outputs dynamically
try {
outputs = (workflow.expression.getSimpleParameterValue(
const result = workflow.expression.getSimpleParameterValue(
node,
nodeTypeData.outputs,
'internal',
{},
) || []) as NodeConnectionType[];
);
outputs = Array.isArray(result)
? (result as Array<NodeConnectionType | INodeOutputConfiguration>)
: [];
} catch (e) {
console.warn('Could not calculate outputs dynamically for node: ', node.name);
}
Expand Down
13 changes: 4 additions & 9 deletions packages/workflow/src/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -697,15 +697,10 @@ export class Workflow {
const outputs = NodeHelpers.getNodeOutputs(this, node, nodeType.description);
const nonMainConnectionTypes: NodeConnectionType[] = [];

// Defensive check: NodeHelpers.getNodeOutputs should always return an array,
// but in some edge cases (particularly during testing with incomplete node setup),
// it may return undefined or null
if (Array.isArray(outputs)) {
for (const output of outputs) {
const type = typeof output === 'string' ? output : output.type;
if (type !== NodeConnectionTypes.Main) {
nonMainConnectionTypes.push(type);
}
for (const output of outputs) {
const type = typeof output === 'string' ? output : output.type;
if (type !== NodeConnectionTypes.Main) {
nonMainConnectionTypes.push(type);
}
}

Expand Down
Loading