From 4dc458eca5587cf7765bed6fd384d47a31e66e2c 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: Mon, 13 Feb 2023 16:16:53 +0100 Subject: [PATCH] fix(core): Fix the issue with test webhooks getting removed incorrectly (no-changelog) (#5466) This broke because of the change [here](https://github.com/n8n-io/n8n/pull/5443/files#diff-b386248ff00977749c873ed85821c241b773e9740d7e7adf94e05b73b350ed74L152). `finally` block is called even if there is a `return` in the `try` block, and this is causing the test webhook to be removed, even when it shouldn't be removed. --- packages/cli/src/TestWebhooks.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/TestWebhooks.ts b/packages/cli/src/TestWebhooks.ts index aee337ec74..12ec4a6827 100644 --- a/packages/cli/src/TestWebhooks.ts +++ b/packages/cli/src/TestWebhooks.ts @@ -141,13 +141,13 @@ class TestWebhooks { if (sessionId !== undefined) { push.send('testWebhookReceived', { workflowId, executionId }, sessionId); } - } finally { - // Delete webhook also if an error is thrown - if (timeout) clearTimeout(timeout); - delete testWebhookData[webhookKey]; + } catch {} - await activeWebhooks.removeWorkflow(workflow); - } + // Delete webhook also if an error is thrown + if (timeout) clearTimeout(timeout); + delete testWebhookData[webhookKey]; + + await activeWebhooks.removeWorkflow(workflow); }); }