Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We use the Airbrake package to handle sending error notifications to our Errbit instance. This is how we can see and track errors without having to scan production logs.
A notification can be sent
omfg()
methodsWell, that's what it should have been doing! We spotted when calling our
/health/airbrake
endpoint that nothing was reaching Errbit. After some investigation, we found 2 issues.The first was a new config item
errorNotifications
introduced in Add support for remote notifier config.This should default to
true
if not set when instantiating your Airbrake notifier. But for reasons we admittedly didn't get to the bottom of, this was not the case when we manually called Airbrake'snotify()
method. So, we would see the following in our logsSetting it to
true
when instantiating the Notifier instance resolved this issue (N.B. whilst there we also setremoteConfig
tofalse
just in case 😁)The second was our error pages plugin. In the event of an error on a route we haven't configured to use plain output, the plugin ensures our error page is returned. But this stopped a Hapi error event from being fired. Because of this, our logic in the Airbrake plugin wasn't being triggered.
We fix this by using the
RequestNotifier
we add to every request within the error pages plugin instead of usingserver.logger.error()
directly. Using that gets us both a log message and an Airbrake notification.