From 88230e9dc096a537d7eab24b01b78d02fff26834 Mon Sep 17 00:00:00 2001 From: Kushal <43465488+kushalshit27@users.noreply.github.com> Date: Thu, 28 Nov 2024 11:47:45 +0530 Subject: [PATCH] Add error handling for trigger bindings (#991) --- src/tools/auth0/handlers/triggers.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/tools/auth0/handlers/triggers.ts b/src/tools/auth0/handlers/triggers.ts index f2726cc9f..356e02954 100644 --- a/src/tools/auth0/handlers/triggers.ts +++ b/src/tools/auth0/handlers/triggers.ts @@ -62,10 +62,21 @@ export default class TriggersHandler extends DefaultHandler { for (let i = 0; i < triggers.length; i++) { const triggerId = triggers[i]; - const { data } = await this.client.actions.getTriggerBindings({ - triggerId: triggerId, - }); - const { bindings } = data; + let bindings; + try { + const { data } = await this.client.actions.getTriggerBindings({ + triggerId: triggerId, + }); + + bindings = data?.bindings; + } catch (err) { + log.warn( + `${err.message} (trigger: ${triggerId}). Skipping this trigger and continuing.` + ); + + continue; + } + if (bindings && bindings.length > 0) { triggerBindings[triggerId] = bindings.map((binding) => ({ action_name: binding.action.name,