fix(core): Consider subworkflows successfully run when in waiting state (#7699)

Github issue / Community forum post (link here to close automatically):
https://github.com/n8n-io/n8n/issues/7189
This commit is contained in:
Michael Auerswald 2023-11-14 11:04:24 +01:00 committed by GitHub
parent 9b3be0cfd8
commit 0e00dab9f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,6 +23,7 @@ import type {
IWorkflowSettings,
WorkflowExecuteMode,
ExecutionStatus,
ExecutionError,
} from 'n8n-workflow';
import {
ErrorReporterProxy as ErrorReporter,
@ -902,10 +903,11 @@ async function executeWorkflow(
}
data = await workflowExecute.processRunExecutionData(workflow);
} catch (error) {
const executionError = error ? (error as ExecutionError) : undefined;
const fullRunData: IRun = {
data: {
resultData: {
error,
error: executionError,
runData: {},
},
},
@ -941,9 +943,9 @@ async function executeWorkflow(
);
throw objectToError(
{
...error,
stack: error.stack,
message: error.message,
...executionError,
stack: executionError?.stack,
message: executionError?.message,
},
workflow,
);
@ -953,7 +955,8 @@ async function executeWorkflow(
void internalHooks.onWorkflowPostExecute(executionId, workflowData, data, additionalData.userId);
if (data.finished === true) {
// subworkflow either finished, or is in status waiting due to a wait node, both cases are considered successes here
if (data.finished === true || data.status === 'waiting') {
// Workflow did finish successfully
activeExecutions.remove(executionId, data);
@ -961,13 +964,14 @@ async function executeWorkflow(
return returnData!.data!.main;
}
activeExecutions.remove(executionId, data);
// Workflow did fail
const { error } = data.data.resultData;
throw objectToError(
{
...error,
stack: error!.stack,
stack: error?.stack,
},
workflow,
);