Auth0 Home Blog Docs

Getting notified if a Hook fails



As far as I can tell, if a hook fails, there’s no simple way to know unless you’ve explicitly written something in the hook to notify an external system.

Is that correct?

If so, are there any recommended best practices to surface hook failures to a system like SNS or Sentry or some other log catcher?

Does this have to be encoded into the hook, or can you make them return an error state have configure a different part of Auth0 to route this to somewhere useful?


FWIW, I added this to my hook:

(err, response) => {
      var Raven = require('raven');
        'My DSN'

      Raven.context(function runRaven() {
          extra: context
        if (err) {
          console.log('Reporting to Raven');
          Raven.captureException(new Error(err));
          return cb(new Error(err));
        if (response.statusCode >= 400) {
          console.log('Reporting to Raven');
            new Error(`Bad status from email service: ${response.statusCode}`),
            {extra: {response}}
        return cb();

I have a Sentry project for Auth0 notifications to keep an eye on things