From 1ef862782f384f3ada58b238fd0349d9c9834d5b Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Tue, 22 Nov 2022 12:51:59 +0800 Subject: [PATCH] Catch error from sending notification api --- packages/rule-handler/package.json | 1 - packages/rule-handler/src/notification.ts | 16 ++++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/rule-handler/package.json b/packages/rule-handler/package.json index 41f80a65e..b9eadc9c4 100644 --- a/packages/rule-handler/package.json +++ b/packages/rule-handler/package.json @@ -24,7 +24,6 @@ "@sentry/serverless": "^6.16.1", "axios": "^0.27.2", "dotenv": "^16.0.1", - "firebase-admin": "^10.0.2", "jsonwebtoken": "^8.5.1", "search-query-parser": "^1.6.0" } diff --git a/packages/rule-handler/src/notification.ts b/packages/rule-handler/src/notification.ts index 287d9e886..6a12a94a2 100644 --- a/packages/rule-handler/src/notification.ts +++ b/packages/rule-handler/src/notification.ts @@ -26,10 +26,14 @@ export const sendNotification = async ( notificationType: 'rule', } - await axios.post(`${apiEndpoint}/notification/send`, data, { - headers: { - Cookie: `auth=${auth};`, - 'Content-Type': 'application/json', - }, - }) + try { + await axios.post(`${apiEndpoint}/notification/send`, data, { + headers: { + Cookie: `auth=${auth};`, + 'Content-Type': 'application/json', + }, + }) + } catch (e) { + console.error(e) + } }