-
Notifications
You must be signed in to change notification settings - Fork 173
fix for entity-bound triggers error #990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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)
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.
|
Hi, @Ryan-Tassat This can be added on config: {
"AUTH0_EXCLUDED": ["triggers"]
} |
|
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 |
| const triggers: string[] = _(res.data.triggers).map('id').uniq().value(); | ||
| let triggerId: string; | ||
|
|
||
| for (let i = 0; i < triggers.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
|
I will create a new PR |
|
Add a new #991 Thank you for submitting this PR! I really appreciate the time and effort you put into it. |
🔧 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