🐛 Fix bug with expression in production webhook paths

This commit is contained in:
Jan Oberhauser 2021-04-11 15:45:17 +02:00
parent 7a99f4256f
commit 8f3bc32555

View file

@ -20,7 +20,6 @@ import {
} from 'n8n-core'; } from 'n8n-core';
import { import {
IDataObject,
IExecuteData, IExecuteData,
IGetExecutePollFunctions, IGetExecutePollFunctions,
IGetExecuteTriggerFunctions, IGetExecuteTriggerFunctions,
@ -283,23 +282,11 @@ export class ActiveWorkflowRunner {
const node = workflow.getNode(webhookData.node) as INode; const node = workflow.getNode(webhookData.node) as INode;
node.name = webhookData.node; node.name = webhookData.node;
path = node.parameters.path as string; path = webhookData.path;
if (node.parameters.path === undefined) {
path = workflow.expression.getSimpleParameterValue(node, webhookData.webhookDescription['path'], mode) as string | undefined;
if (path === undefined) {
// TODO: Use a proper logger
console.error(`No webhook path could be found for node "${node.name}" in workflow "${workflow.id}".`);
continue;
}
}
const isFullPath: boolean = workflow.expression.getSimpleParameterValue(node, webhookData.webhookDescription['isFullPath'], mode, false) as boolean;
const webhook = { const webhook = {
workflowId: webhookData.workflowId, workflowId: webhookData.workflowId,
webhookPath: NodeHelpers.getNodeWebhookPath(workflow.id as string, node, path, isFullPath), webhookPath: path,
node: node.name, node: node.name,
method: webhookData.httpMethod, method: webhookData.httpMethod,
} as IWebhookDb; } as IWebhookDb;
@ -317,7 +304,6 @@ export class ActiveWorkflowRunner {
} }
try { try {
await Db.collections.Webhook?.insert(webhook); await Db.collections.Webhook?.insert(webhook);
const webhookExists = await workflow.runWebhookMethod('checkExists', webhookData, NodeExecuteFunctions, mode, activation, false); const webhookExists = await workflow.runWebhookMethod('checkExists', webhookData, NodeExecuteFunctions, mode, activation, false);