Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log webhook processing into the Rails logger #20

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

julik
Copy link
Contributor

@julik julik commented Aug 8, 2024

The issue with Rails error reporting is that by default it does not print into the logs, it seems. This removes a very basic affordance of seeing that your webhooks do not validate. Raising an error during some kind of "validation" is something Rails does only when this behavior is requested explicitly or when a ! method is used (such as save! or create!).

What we want is to make it easier for the developer to see their signature verification is misconfigured, not "more correct". Besides, a failing validation is not an error - it is a predictable (and externally inducible) event. For instance, if someone spams the application with webhooks with incorrect signatures - this is not an error, as the application rejects those webhooks anyway.

So: when processing, log useful data into the Rails log, and only send through errors which get raised by the handler or "upstream" operations.

The issue with Rails error reporting is that by default it does not print into the logs, it seems. This removes a very basic affordance of seeing that your webhooks do not validate. Raising an error during some kind of "validation" is something Rails does _only_ when this behavior is requested explicitly or when a `!` method is used (such as `save!` or `create!`).

What we want is to make it easier for the developer to see their signature verification is misconfigured, not "more correct". Besides, a failing validation is not an error - it is a predictable (and externally inducible) event. For instance, if someone spams the application with webhooks with incorrect signatures - this is not an _error_, as the application rejects those webhooks anyway.

So: when processing, log useful data into the Rails log, and only send through errors which get raised by the handler or "upstream" operations.
@julik julik requested a review from svanhesteren August 8, 2024 11:37
Copy link

@svanhesteren svanhesteren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool

@julik julik merged commit 44f2971 into main Aug 8, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants