How to Debug a Webhook Delivery
Start webhook debugging from the sender delivery log, then capture the raw request and log the delivery id in your handler.
Most senders keep a delivery log with the request, response, and a redeliver button. Point the hook at a request bin to see raw bytes, and log X-GitHub-Delivery so you can correlate.
Steps
- Open the sender delivery log and read the response code and body.
- Point the hook at a request bin to capture raw headers and body.
- Log the delivery id in your handler to correlate with the sender.
Log the delivery id
handler.js
app.post('/webhook', (req, res) => {
const id = req.headers['x-github-delivery'];
const event = req.headers['x-github-event'];
console.log(JSON.stringify({ id, event, len: req.rawBody?.length }));
// ... verify and process
res.status(200).end();
});Gotchas
- A 302 or HTML response usually means the request hit a login page, not your handler.
- Use the sender redeliver button rather than forcing a real event to reproduce.
Related guides
How to Relay Webhooks to Localhost for TestingRelay production webhooks to a handler on localhost during development using smee.io, ngrok, or cloudflared,…
How to Add a Dead-Letter Queue for Failed WebhooksCapture webhook deliveries that fail processing in a dead-letter store so you can inspect, fix, and replay th…