From f56960f0ccd98782e2e9b475c1235a384b368fde Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Thu, 27 Aug 2020 13:37:17 +0200 Subject: [PATCH] :bug: Remove Test-Webhook also if checkExists fails --- packages/core/src/ActiveWebhooks.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/core/src/ActiveWebhooks.ts b/packages/core/src/ActiveWebhooks.ts index 69bc731b08..5b69fab246 100644 --- a/packages/core/src/ActiveWebhooks.ts +++ b/packages/core/src/ActiveWebhooks.ts @@ -50,20 +50,20 @@ export class ActiveWebhooks { // it gets called this.webhookUrls[webhookKey] = webhookData; - const webhookExists = await workflow.runWebhookMethod('checkExists', webhookData, NodeExecuteFunctions, mode, this.testWebhooks); - if (webhookExists === false) { - // If webhook does not exist yet create it - try { + try { + const webhookExists = await workflow.runWebhookMethod('checkExists', webhookData, NodeExecuteFunctions, mode, this.testWebhooks); + if (webhookExists === false) { + // If webhook does not exist yet create it await workflow.runWebhookMethod('create', webhookData, NodeExecuteFunctions, mode, this.testWebhooks); - } catch (error) { - // If there was a problem unregister the webhook again - delete this.webhookUrls[webhookKey]; - delete this.workflowWebhooks[webhookData.workflowId]; - throw error; } - } + } catch (error) { + // If there was a problem unregister the webhook again + delete this.webhookUrls[webhookKey]; + delete this.workflowWebhooks[webhookData.workflowId]; + throw error; + } this.workflowWebhooks[webhookData.workflowId].push(webhookData); }