From 258567724e1d0fb6c736d9b43b1f4aa57391062d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Fri, 19 May 2023 13:37:05 +0200 Subject: [PATCH] fix(core): Prevent app crashes because of unhandled promises in poll and trigger nodes fixes https://community.n8n.io/t/n8n-server-container-after-read-econnreset-and-write-epipe-errors-in-imap-version-2-node/24012 --- packages/cli/src/ActiveWorkflowRunner.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/ActiveWorkflowRunner.ts b/packages/cli/src/ActiveWorkflowRunner.ts index ca175b303b715..1cbfca63073ee 100644 --- a/packages/cli/src/ActiveWorkflowRunner.ts +++ b/packages/cli/src/ActiveWorkflowRunner.ts @@ -651,9 +651,10 @@ export class ActiveWorkflowRunner { } }; - returnFunctions.__emitError = async (error: ExecutionError): Promise => { - await createErrorExecution(error, node, workflowData, workflow, mode); - this.executeErrorWorkflow(error, workflowData, mode); + returnFunctions.__emitError = (error: ExecutionError): void => { + void createErrorExecution(error, node, workflowData, workflow, mode).then(() => { + this.executeErrorWorkflow(error, workflowData, mode); + }); }; return returnFunctions; }; @@ -707,7 +708,7 @@ export class ActiveWorkflowRunner { executePromise.catch(Logger.error); } }; - returnFunctions.emitError = async (error: Error): Promise => { + returnFunctions.emitError = (error: Error): void => { Logger.info( `The trigger node "${node.name}" of workflow "${workflowData.name}" failed with the error: "${error.message}". Will try to reactivate.`, { @@ -719,7 +720,7 @@ export class ActiveWorkflowRunner { // Remove the workflow as "active" - await this.activeWorkflows.remove(workflowData.id); + void this.activeWorkflows.remove(workflowData.id); this.activationErrors[workflowData.id] = { time: new Date().getTime(), error: {