Skip to content

Conversation

@Ryan-Tassat
Copy link

🔧 Changes

Just a quick fix for the issue introduced with custom-token-exchange being returned when calling the triggers API.
This will continue even if the API responds with the "cannot list action bindings for an entity-bound trigger" response (400 response code). May be a cleaner way to do this, but it does the job for now!

All it does is adds a new check in the catch section of the try-catch that makes a call to the triggerBindings endpoint.

📚 References

🔬 Testing

Try running a full export with debug mode enabled. Without this "fix" the export will break and not complete successfully. With this fix, it'll just "warn" about the issue.

📝 Checklist

  • [ X ] All new/changed/fixed functionality is covered by tests (or N/A)
  • [ X ] I have added documentation for all new/changed functionality (or N/A)

Just a quick-fix for the issue introduced with custom-token-exchange being returned when calling the triggers API. This will continue even if the API responds with the "cannot list action bindings for an entity-bound trigger" response (400 response code)
@Ryan-Tassat Ryan-Tassat requested a review from a team as a code owner November 27, 2024 12:37
Forgot to add this which just allows our warn to come back with the ID of the trigger that fails/warns us.
I messed up the formatting of the new log message. Fixed that here.
@kushalshit27
Copy link
Contributor

Hi, @Ryan-Tassat
We are checking this, mean time to bypass any operation on triggers,

This can be added on config:

{
 "AUTH0_EXCLUDED": ["triggers"]
}

@Ryan-Tassat
Copy link
Author

Thanks @kushalshit27 - Feel free to bin this PR. The builds didn't pass 😅 - My TS is rusty and I somehow fudged the definition of triggerId

@kushalshit27 kushalshit27 changed the title Temp fix for entity-bound triggers error fix for entity-bound triggers error Nov 27, 2024
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.

@kushalshit27
Copy link
Contributor

I will create a new PR

@kushalshit27
Copy link
Contributor

kushalshit27 commented Nov 27, 2024

Add a new #991

Thank you for submitting this PR! I really appreciate the time and effort you put into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants