If you would like to know more about webhooks and how to utilize them with New Relic Alerts, check out this other awesome post, “All About Webhooks.” In this post, we are jumping straight into troubleshooting.
When creating a webhook channel in New Relic Alerts, you are given the option to test your webhook after saving your settings. Most of the time, you will see something like:
However, once in a while you will run into some messages letting you know that your webhook test notification wasn’t successful.
Here are a couple ways you can troubleshoot your webhook configuration when seeing these errors.
1. Understand the error.
The webhook test notification responses have the following format:
“Test notification successful…response: 200” = we (New Relic) successfully queued up and attempted to send the notification.
Note: If you see any other messages here, there may have been an issue queueing the notification. Contact support if this occurs.
“Webhook responded with HTTP status code 404” = The endpoint responded with a 404 error when we attempted to send the webhook.
2. Diagnose the origin: endpoint or payload?
The two primary culprits for a failing webhook are the endpoint and the payload. The easiest thing to test out of these two is the payload. A great way to test this is to use RequestBin to generate a new endpoint. RequestBin also allows you to view the received payload.
If another error is returned when using RequestBin, your payload may be formatted incorrectly, or in a way that New Relic does not support.
Testing your endpoint is a little tricky, because there are a variety of factors that could be affecting the success of the webhook, such as your configuration, your firewall and network security, etc. Here are a few tips to help you.
a) Use RequestBin again!
The RequestBin endpoint will serve as a good control, helping you rule out other factors. If your webhook sends successfully to RequestBin, but not to your endpoint, you can be fairly certain the issue lies somewhere between New Relic and your endpoint.
b) Check 3rd-party documentation.
If you are using the webhook channel to push information to a 3rd party service, doublecheck their documentation! They may have specific formatting requirements for webhook payloads.
c) Check your server logs.
If there is a network or firewall issue preventing the webhook from sending successfully, your server logs should give you more insight into the specific error information being returned.