Hotfix a production error from a stack trace

Paste an error from production, and Devboxes comes back with a hotfix and tests that reproduce the crash.

  • Engineering
  • Operations
Search Acme

billing

2
  1. Tom

    @Devboxes refunds stopped reaching the ledger overnight, every charge.refunded webhook crashes with TypeError: Cannot read properties of undefined (reading 'data') at bookRefund (src/payments/stripe-webhooks.ts:88)

  2. Devboxes APP

    Looked at 5 sources
    1. Slack Read the stack trace in this thread
    2. GitHub Opened stripe-webhooks.ts at line 88
    3. Terminal Reproduced the crash in its workspace
    4. Terminal Ran the new refund tests
    5. GitHub Read the checks on #51

    Hotfix is up in #51. Charges don't include the refund list anymore, so the handler now books from amount_refunded. Partial refunds come in as several events, so it books only what isn't booked yet. Tests cover both, and checks pass.

    GitHub

    #51 Book refunds from amount_refunded

    Open devboxes/refund-webhook-hotfix 3 checks passed

    Ready for review

acme / ledger

Book refunds from amount_refunded #51

Open

devboxes[bot] wants to merge 1 commit into main from devboxes/refund-webhook-hotfix

devboxes Bot reviewed 2 minutes ago View reviewed changes

devboxes Bot left a comment Author

A full refund books once, a partial refund books only the new part, and a replayed event books nothing.

All checks have passed

3 successful checks

  • CI / Lint (pull_request) Details
  • CI / Typecheck (pull_request) Details
  • CI / Tests (pull_request) Details

This branch has no conflicts with the base branch

Merging can be performed automatically.

You can also merge this with the command line.

Files changed 2

  • src/payments/stripe-webhooks.ts +21 −7
  • test/refund-webhook.test.ts +64 −0