fix(n8n Form Node): Form Trigger does not wait in multi-form mode (#11404)

This commit is contained in:
Michael Kret
2024-10-25 13:49:36 +03:00
committed by GitHub
parent 8b0a48f530
commit 151f4dd7b8
3 changed files with 38 additions and 25 deletions

View File

@@ -102,7 +102,9 @@ export class WaitingWebhooks implements IWebhookManager {
}
if (execution.data?.resultData?.error) {
throw new ConflictError(`The execution "${executionId} has finished already.`);
const message = `The execution "${executionId}" has finished with error.`;
this.logger.debug(message, { error: execution.data.resultData.error });
throw new ConflictError(message);
}
if (execution.finished) {
@@ -182,23 +184,25 @@ export class WaitingWebhooks implements IWebhookManager {
if (this.isSendAndWaitRequest(workflow.nodes, suffix)) {
res.render('send-and-wait-no-action-required', { isTestWebhook: false });
return { noWebhookResponse: true };
} else if (!execution.data.resultData.error && execution.status === 'waiting') {
}
if (!execution.data.resultData.error && execution.status === 'waiting') {
const childNodes = workflow.getChildNodes(
execution.data.resultData.lastNodeExecuted as string,
);
const hasChildForms = childNodes.some(
(node) =>
workflow.nodes[node].type === FORM_NODE_TYPE ||
workflow.nodes[node].type === WAIT_NODE_TYPE,
);
if (hasChildForms) {
return { noWebhookResponse: true };
} else {
throw new NotFoundError(errorMessage);
}
} else {
throw new NotFoundError(errorMessage);
}
throw new NotFoundError(errorMessage);
}
const runExecutionData = execution.data;