How to parse, validate and handle webhooks and monitor their deliveries on Polar
POLAR_WEBHOOK_SECRET
to be set to the secret you configured during the endpoint setup.
ngrok
or whatever tunneling service you’re using
during local development.
Add excessive logging
E.g
console.log('webhook.handler_called')
,
console.log('webhook.validate_signature')
,
console.log('webhook.signature_validated')
etc.
So you can easily confirm if the handler is called and how far it gets before
any issues arise.
HTTP 404
curl -vvv -X POST <copy-paste-endpoint-url>
in your terminal to confirm the
route exists and see any issues along the way/
to the URL on Polar. Often /foo
is resolved to
/foo/
by frameworks.HTTP 403