From c29eaed4011b4685df52f8576bc3ce6a74cbb684 Mon Sep 17 00:00:00 2001 From: Adam Majmudar Date: Tue, 9 Jan 2024 14:42:06 -0800 Subject: [PATCH] Add try/catch to webhook request --- src/server/utils/webhook.ts | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/server/utils/webhook.ts b/src/server/utils/webhook.ts index 828385a9f..7fe2f1b6f 100644 --- a/src/server/utils/webhook.ts +++ b/src/server/utils/webhook.ts @@ -118,19 +118,21 @@ export const sendTxWebhook = async (queueIds: string[]): Promise => { } } - webhookConfig?.map(async (config) => { - if (!config || !config?.active) { - logger({ - service: "server", - level: "debug", - message: "No webhook set or active, skipping webhook send", - }); - - return; - } - - await sendWebhookRequest(config, txData); - }); + await Promise.all( + webhookConfig?.map(async (config) => { + if (!config || !config?.active) { + logger({ + service: "server", + level: "debug", + message: "No webhook set or active, skipping webhook send", + }); + + return; + } + + await sendWebhookRequest(config, txData); + }) || [], + ); } } } catch (error) {