fix(core): Prevent app crashes because of unhandled promises in poll and trigger nodes (#6278)

fixes https://community.n8n.io/t/n8n-server-container-after-read-econnreset-and-write-epipe-errors-in-imap-version-2-node/24012
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-05-19 13:43:50 +00:00 committed by GitHub
parent be5d3264ad
commit 37506050c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -651,9 +651,10 @@ export class ActiveWorkflowRunner {
} }
}; };
returnFunctions.__emitError = async (error: ExecutionError): Promise<void> => { returnFunctions.__emitError = (error: ExecutionError): void => {
await createErrorExecution(error, node, workflowData, workflow, mode); void createErrorExecution(error, node, workflowData, workflow, mode).then(() => {
this.executeErrorWorkflow(error, workflowData, mode); this.executeErrorWorkflow(error, workflowData, mode);
});
}; };
return returnFunctions; return returnFunctions;
}; };
@ -707,7 +708,7 @@ export class ActiveWorkflowRunner {
executePromise.catch(Logger.error); executePromise.catch(Logger.error);
} }
}; };
returnFunctions.emitError = async (error: Error): Promise<void> => { returnFunctions.emitError = (error: Error): void => {
Logger.info( Logger.info(
`The trigger node "${node.name}" of workflow "${workflowData.name}" failed with the error: "${error.message}". Will try to reactivate.`, `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" // Remove the workflow as "active"
await this.activeWorkflows.remove(workflowData.id); void this.activeWorkflows.remove(workflowData.id);
this.activationErrors[workflowData.id] = { this.activationErrors[workflowData.id] = {
time: new Date().getTime(), time: new Date().getTime(),
error: { error: {