Now with MCP · your agent can query commission, affiliates, and payouts. Read-only. Connect a client
← Blog

The Bug That Wasn't a Bug: What We Built Instead

A customer's webhook 'wasn't working.' Five debugging rounds later, the code was fine, our design made config errors invisible. What we shipped instead.

SSled10 min read
·Share on X

This is a short post about a customer email we got this week, the five-round debugging session it triggered, and the product changes we shipped in response. We're writing it publicly because the lesson generalizes, and because the founder who sent that email deserves credit (anonymized at their privacy's expense, but credit nonetheless) for making Sled measurably better in a single afternoon.

Update, a few hours later: Within hours of shipping the dashboard view described below, the same customer triggered another webhook test and it immediately surfaced a different real bug, a casing mismatch (camelCase vs snake_case) between Polar's webhook SDK output and our normalizer. Without the new Webhooks tab, that bug would have stayed silent and bitten every future Polar customer the same way. We fixed it in ten minutes. The investment paid for itself the same day it shipped. More on this at the end of the post.

Us, watching the first webhook actually show up in the new dashboard tab

The email

Thursday morning, a founder building a SaaS on Polar.sh signed up for Sled, configured his webhook, ran a test order, and got nothing. He emailed us:

"Polar shows the webhook delivered successfully (200 OK), but no conversion is appearing in my Sled dashboard. Two things in the payload might be relevant: the product uses seat-based pricing, and the order total is only $6.95 due to a 95% test discount. Could either of these be hitting a silent drop on your side?"

Polite, technical, hypothesis-driven. The kind of bug report you dream of receiving. He even attached the full Polar webhook payload.

We opened the diagnostic.

Why both of his hypotheses were wrong

His first guess was that our handler couldn't parse seat-based pricing, Polar exposes several pricing models (fixed, tiered, seat-based, usage-based) and each has slightly different fields. Reasonable concern. But our normalizer only reads the order's total_amount / net_amount / subtotal_amount fields. It doesn't care about the underlying price object at all. Seat-based, tiered, fixed, same code path.

His second guess was that the $6.95 amount was below some silent-drop threshold. Also reasonable, we had shipped a fix the week before for a bug that incorrectly dropped $0 orders (caused by ?? falling through on a literal zero). But that fix wasn't a threshold; the actual rule is amount > 0, and $6.95 passes that comfortably.

So both hypotheses were technically off. We could have replied with a one-line "neither of those is the issue, please share your webhook URL and signing secret", and we did, eventually. But we wanted to be sure before pointing the finger back at his config, because the worst support reply is "it's your config" when it's actually your code.

The five rounds

So we traced the payload through the entire pipeline:

  1. Round 1: Confirmed the schema flag, the blockSelfReferral setting was on by default. We block conversions where the customer email matches an affiliate email (it's the #1 fraud vector for self-purchase discounting). Could that be the silent rejection? But the affiliate's email and the customer's email were different. Self-referral guard doesn't trigger.

  2. Round 2: Queried the database directly. The affiliate code in question existed, was active, had the right email. Not a "no-affiliate" case.

  3. Round 3: Checked for duplicates. No prior conversion existed for the order ID. Not a dedup case.

  4. Round 4: Counted all conversions for this tenant, zero. Ever. So either the webhook had genuinely never reached our endpoint, or something deeper was wrong.

  5. Round 5: Reproduced the customer's exact payload via curl against the production endpoint, with the signature check temporarily disabled. Result: HTTP/2 200, {"status":"ok"}, conversion created cleanly. The code worked.

That meant the issue was upstream, either the webhook wasn't actually reaching us (despite Polar's dashboard showing "200 OK") or the signature was failing. Either way: a config error on the customer's side, not a bug on ours.

But the real bug was ours

Here's the part we want to be honest about. Even though the code was fine, we had failed the customer.

The customer was looking at his dashboard and seeing nothing. From his perspective, the product was broken. He had no way to verify whether his webhook was reaching us, no way to see whether the signature was matching, no way to distinguish "your config is off" from "their code has a silent bug." The only person who could tell the difference was us, squinting at Vercel function logs that no customer can access.

That's a design failure. The product was working as built, and the customer's experience was that it was broken. Both true, simultaneously.

The right response to that kind of mismatch isn't "explain to the customer why their config is wrong." It's "rebuild the product so the customer can answer the question themselves in 10 seconds, without emailing anyone."

What we shipped

Same day:

1. A new database table (WebhookEvent) that records every single inbound webhook delivery to a tenant's endpoint. Provider, event type, status (ok, signature_failed, no-referral, no-affiliate, duplicate, self-referral, invalid_payload), order ID when extractable, and a short structured summary. No headers, no full payload (PII), just the structured surface needed to debug.

2. A new dashboard tab (/dashboard/webhooks) showing the last 50 deliveries in real time. Status is color-coded into four visual buckets:

  • Green (ok): conversion recorded.
  • Gray (duplicate, ignored): harmless, expected behavior.
  • Amber (no-referral, no-affiliate, self-referral): silent drops the customer might care about.
  • Red (signature_failed, invalid_payload): something is broken in the integration.

Each status has a tooltip explaining what it means in plain English. signature_failed reads: "Signature didn't verify. Most common cause: webhook secret in Sled doesn't match the one in your billing dashboard." That's almost certainly the diagnosis the customer would have needed in this case, and now he can read it directly in the UI instead of waiting for us to deduce it.

3. An empty-state with copy-ready webhook URLs. First time a tenant lands on the Webhooks tab with no deliveries yet, they see their exact endpoint URL pre-formatted, ready to paste into Polar or any other provider. Removes the most common typo source (forgetting the tenant slug in the URL).

4. A fire-and-forget logger that never throws. Logging itself can never break webhook delivery, if the database write fails for any reason, we swallow the error and log to console. Otherwise a logging hiccup could cause our handler to 500, Polar would retry, and we'd double-pay commissions. Worse than no logging.

The whole change is one migration, one new helper, two route edits, and one new page. Maybe 200 lines of TypeScript. The customer who triggered it will get to use it as one of the first benefits.

The plot twist (a few hours later)

We shipped the Webhooks tab around noon. By mid-afternoon the same customer had re-triggered his webhook test from the Polar dashboard, looked at the new Webhooks tab, and seen a status he'd never seen before: ignored.

That status means our normalizer parsed the payload but decided the event wasn't attributable, usually because it's a non-order event we don't process (like subscription.created). But the customer's event WAS an order.created with a real amount. So why ignored?

He sent us the screenshot. We pulled the Vercel function log and saw the smoking gun in the shape line:

data=[id, createdAt, modifiedAt, status, totalAmount, netAmount,
      subtotalAmount, customerId, subscriptionId, ...]

Every field name was camelCase. Our normalizer was reading snake_case (total_amount, net_amount, etc.), none of those fields existed in the parsed object, so the amount fell through to 0, and the "don't record orders with zero amount" guard kicked in. Silent ignore.

The reason this bug had been invisible until now: Polar exposes the same payload in two different casings depending on how you parse it.

  • Snake_case: what Polar's dashboard payload viewer shows, what raw JSON.parse(rawBody) produces, and what gets used if you POST to a route that has no webhook secret configured.
  • camelCase: what validateEvent() from the official @polar-sh/sdk returns, because the SDK's TypeScript types are camelCase. This is what production webhooks actually deliver when signature validation is enabled.

Our earlier curl reproduction during the original debug session had bypassed the SDK (we'd temporarily nulled the webhook secret to skip signature verification, since we didn't have the customer's secret). The raw JSON he'd pasted in his original email was snake_case. So JSON.parse(raw) produced a snake_case object, and the normalizer worked. We declared the code path "verified end-to-end" and moved on. We were wrong, we'd verified the wrong path.

In production, with signatures actually being validated, the customer's webhook payloads went through the SDK, came out camelCase, and broke. The Webhooks tab caught it within minutes of his next test.

The fix was 7 lines of code. Read both casings for every field; pick the first non-empty value:

const amountCandidates = [
  data.total_amount, data.totalAmount,
  data.net_amount, data.netAmount,
  data.subtotal_amount, data.subtotalAmount,
  data.due_amount, data.dueAmount,
  data.amount,
];

Deployed within ten minutes of the customer's screenshot. His next test came in as ok and the conversion landed in real time.

The cost of that bug, if the Webhooks tab hadn't existed: every new Polar customer would have hit silent webhook ignores, emailed us in frustration, and we'd have repeated the multi-round diagnosis on each one until someone got lucky enough to inspect the log shape carefully. Visibility didn't just help this one customer, it caught a class of bug we were about to ship to many more.

What we learned

A few takeaways that we'll keep with us:

1. The first hypothesis from a smart customer is often wrong, but the email is still gold. This founder was wrong about seat-based pricing and the discount threshold, but his email triggered the diagnostic that exposed a structural visibility gap that every future customer would have hit. The wrongness of his hypothesis didn't reduce the value of his report.

2. "Working as designed" is the most dangerous phrase in product. If a customer can't tell whether your product is working, then it isn't, regardless of what your tests say. Visibility is part of the product.

3. Founder logs ≠ customer logs. We had perfect observability through Vercel. The customer had zero. That gap was invisible to us because we never sat in the customer's seat. The fix wasn't more logging on our side, it was logging that the customer could see.

4. Fast turnaround is its own feature. From the customer's email to the new dashboard tab in production: a few hours. From the dashboard tab going live to it catching a real bug: a few more hours. From bug-caught to fix-deployed: ten minutes. The entire arc from "customer reports nothing works" to "structural product change shipped, second bug caught, second fix shipped" fit inside a single working day. That speed isn't a virtue, it's the bar. When a customer takes the time to write a clear bug report, the right response is structural change (not a one-off support reply) and the structural change tends to pay for itself faster than you'd expect.

5. Verify the right code path. The single biggest mistake of this saga was on us: during the original curl reproduction, we bypassed signature validation to avoid needing the customer's secret. That choice flipped the parser path from SDK (validateEvent) to raw (JSON.parse) and silently changed the field casing. We thought we'd verified end-to-end. We hadn't. Lesson: when you're reproducing a customer bug, your test setup has to match the production path exactly, including authentication and middleware. Otherwise you're testing a different code path and you'll convince yourself the bug doesn't exist when it absolutely does.

Thank you, you-know-who-you-are

To the founder who sent that email: thank you. You probably thought you were just reporting a bug. You actually reshaped a part of the product that every customer from now on will benefit from. The fact that you sent a detailed payload, hypothesized in good faith, and stuck with us through five rounds of "can you run this SQL?" is the entire reason this got shipped this week instead of in a few months.

We didn't name you in this post because we didn't ask permission. But you know who you are, and we owe you. Your dashboard now has the Webhooks tab. If your next test goes red, you'll know exactly why, without us in the loop. That's the world we want to build.


Have you hit a wall with Sled? Email me directly, I read every word and ship fast. Or start a free trial and see the new Webhooks tab for yourself.

Try Sled

Recurring commission on every renewal.

Polar-native affiliate tracking, with Stripe and Paddle handled the same way. 10-day trial, no card required, cancel anytime. Then $19/mo or $99/yr.

Keep reading

All posts →