Skip to content

Commit

Permalink
Less noisy webhook logs (#669)
Browse files Browse the repository at this point in the history
mbianco-stripe authored Aug 16, 2022

Unverified

The key that signed this is expired.
1 parent 731018a commit c0baaf1
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -18,6 +18,8 @@
- If subscription is created and terminated on the same day, cancel is used
- Duplicate price metadata
- Auto-archived price metadata
- Prices which are not created directly from pricebooks (i.e. from order lines, or duplicated because of the one-price-per-subscription) are archived (active = false) after they are used
- Prices which are duplicated because of the one-price-per-subscription) have a special metadata key (salesforce_duplicate = true)

Next:

8 changes: 8 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
@@ -65,6 +65,14 @@ class Application < Rails::Application
# NOTE lograge doesn't include params by default, we need to manually include them here
custom_params = {"params" => event.payload[:params].except('controller', 'action')}

# stripe webhooks are very noisy and gobble up a ton of log space
if event.payload[:params]['controller'] == 'stripe_webhook' && event.payload[:params]['action'] == 'stripe_webhook'
custom_params = {"params" => {
"stripe_event_id" => event.payload[:params]['id'],
"stripe_resource_id" => event.payload[:params].dig('data', 'object', 'id'),
}}
end

# include headers which identify which account and other details the request is coming from=
SALESFORCE_HEADERS.each {|h| custom_params[h] = event.payload[:request].headers[h] }

0 comments on commit c0baaf1

Please sign in to comment.