Skip to content

Commit

Permalink
Add error handling for trigger bindings (#991)
Browse files Browse the repository at this point in the history
  • Loading branch information
kushalshit27 authored Nov 28, 2024
1 parent a13e794 commit 88230e9
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/tools/auth0/handlers/triggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 88230e9

Please sign in to comment.