How to debug your Hookdoo trigger rules
Determining why a certain hook invocation triggered script execution and why certain other did not is a common problem for our users, especially when dealing with complex trigger rule setups and larger JSON payloads.
It often comes down to using separate windows to preview payload through hook invocation detailed view (Home → Hook invocation history list → Show details → Payload tab) and trigger rule setup through hook detailed view (Hooks → Defined hooks list → Details → Trigger rule section). This is obviously cumbersome, especially at this moment while our UI is still in its alpha version.
Today we have released an upgrade for Hookdoo which enables you to inspect trigger rule evaluation for every hook invocation directly through hook invocation detailed view (Home → Hook invocation history list → Show details → Trigger rule debug info tab).
Presented information, for now, is displayed as JSON content consisting of evaluation traces and backtraces. You will recognize that it closely resembles your actual trigger rule definition, but with operators being mentioned as mnemonics (eg. EQL) and additional context being provided from the actual request information for every step of the evaluation. This way you can easily spot any omissions or errors in your trigger rule setup.
In this case, we’ve defined a trigger rule to allow executing our webhook only if request’s query parameters contain key superSecretKey with value matching a string constant, superSecretValue. Example request did not contain that key nor value, so the trigger rule was not satisfied (expression evaluated to false).
For detailed information, we have to look into the backtrace. We see that left-side expression (expression A) evaluated to nil string because the request value from query params superSecretKey was not present. Right-side expression (expression B) constant superSecretValue evaluated to itself. Thus, comparison of nil with superSecretValue evaluated to false, hence the failed trigger.
At this moment we’re still experimenting with this new feature and different ways of displaying its information. We hope you’ll find it useful, be it for debugging existing hooks or for learning how to use our trigger rule feature.
As usual, feel free to contact us or ask us anything at email@example.com.