Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/tools/auth0/handlers/triggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ export default class TriggersHandler extends DefaultHandler {
try {
const res = await this.client.actions.getAllTriggers();
const triggers: string[] = _(res.data.triggers).map('id').uniq().value();
let triggerId: string;

for (let i = 0; i < triggers.length; i++) {
Copy link
Contributor

@kushalshit27 kushalshit27 Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (let i = 0; i < triggers.length; i++) {
for (let i = 0; i < triggers.length; i++) {
const triggerId = triggers[i];
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,
display_name: binding.display_name,
}));
}
}

Hi, @Ryan-Tassat
I have added a suggestion that will only skip the a trigger that is causing the issue.

const triggerId = triggers[i];
triggerId = triggers[i];
const { data } = await this.client.actions.getTriggerBindings({
triggerId: triggerId,
});
Expand All @@ -86,6 +87,11 @@ export default class TriggersHandler extends DefaultHandler {
return {};
}

if (err.message === "cannot list action bindings for an entity-bound trigger") {
log.warn(`${err.message.charAt(0).toUpperCase()}${err.message.slice(1)} (${triggerId})`);
return {};
}

throw err;
}
}
Expand Down