<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: edhiblemeer</title>
    <description>The latest articles on DEV Community by edhiblemeer (@edhiblemeer).</description>
    <link>https://dev.to/edhiblemeer</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3915565%2Fc8a89af7-6062-41a5-8c85-2d218edd7afb.png</url>
      <title>DEV Community: edhiblemeer</title>
      <link>https://dev.to/edhiblemeer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/edhiblemeer"/>
    <language>en</language>
    <item>
      <title>Stripe Webhook Was Silently Failing for 5 Days: The 4xx Retry Trap and the Beginning-of-Month Time Bomb</title>
      <dc:creator>edhiblemeer</dc:creator>
      <pubDate>Wed, 06 May 2026 08:36:01 +0000</pubDate>
      <link>https://dev.to/edhiblemeer/stripe-webhook-was-silently-failing-for-5-days-the-4xx-retry-trap-and-the-beginning-of-month-time-5d2o</link>
      <guid>https://dev.to/edhiblemeer/stripe-webhook-was-silently-failing-for-5-days-the-4xx-retry-trap-and-the-beginning-of-month-time-5d2o</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;21 &lt;code&gt;invoice.paid&lt;/code&gt; webhooks failed for &lt;strong&gt;5 straight days&lt;/strong&gt; in production.&lt;/li&gt;
&lt;li&gt;We only noticed because Stripe sent a "we'll auto-disable this endpoint by 5/10" warning email.&lt;/li&gt;
&lt;li&gt;Root cause: a DB integrity gap caused our handler to &lt;code&gt;throw HttpException(BAD_REQUEST)&lt;/code&gt; 竊・Stripe treats 4xx as &lt;strong&gt;retry-eligible&lt;/strong&gt; 竊・infinite retry loop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lesson&lt;/strong&gt;: Stripe webhook 4xx is &lt;em&gt;not&lt;/em&gt; "client error, give up." It's "please try again." DB lookup misses should be &lt;code&gt;console.warn + 200 OK&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Bonus lesson: &lt;code&gt;invoice.paid&lt;/code&gt; only fires on subscription cycle (once a month). Five days of silent failure went completely unnoticed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm running &lt;a href="https://tasteck.tech" rel="noopener noreferrer"&gt;tasteck&lt;/a&gt;, an industry-specific SaaS for the Japanese nightlife industry. This is a real incident report from production.&lt;/p&gt;

&lt;h2&gt;
  
  
  The wake-up call
&lt;/h2&gt;

&lt;p&gt;One morning, an email from Stripe:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We've encountered an issue when sending an event to your webhook endpoint at &lt;a href="https://api.tasteck.tech/.../payment/webhook" rel="noopener noreferrer"&gt;https://api.tasteck.tech/.../payment/webhook&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We've attempted to send 16 events since 2026-05-01 02:02:21 UTC, all failing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stripe will stop sending events to this endpoint by 2026-05-10 02:02:21 UTC.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If we didn't fix it before 5/10, the endpoint would be &lt;strong&gt;automatically disabled&lt;/strong&gt;. Subscription invoice notifications would just stop. That's catastrophic for a billing-driven SaaS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Triage: is the endpoint dead?
&lt;/h2&gt;

&lt;p&gt;First, a sanity check with curl:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"type":"ping"}'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  https://api.tasteck.tech/.../payment/webhook
&lt;span class="c"&gt;# 竊・201 Created&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The endpoint is alive. Only &lt;strong&gt;specific events from Stripe&lt;/strong&gt; are failing. Different problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding the actual error in PM2 logs
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh prod &lt;span class="s2"&gt;"grep 'subscription' /home/ec2-user/.pm2/logs/api-error.log | tail"&lt;/span&gt;

&lt;span class="c"&gt;# 竊・HttpException: Subscription item not found.  ﾃ・0+&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The handler code (NestJS + TypeORM):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;stripeSubscriptionItem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;em&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getRepository&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;StripeSubscriptionItem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;stripe_id = :stripeId&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;stripeId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;subscriptionId&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getOne&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;stripeSubscriptionItem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;HttpException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Subscription item not found.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;HttpStatus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;BAD_REQUEST&lt;/span&gt;  &lt;span class="c1"&gt;// 竊・this is the problem&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Trap #1: Stripe webhook 4xx IS retry-eligible
&lt;/h2&gt;

&lt;p&gt;This is where REST-API instincts betray you.&lt;/p&gt;

&lt;p&gt;A normal API: "client gave us bad data 竊・return 4xx 竊・client should fix it 竊・don't retry."&lt;/p&gt;

&lt;p&gt;But Stripe webhooks are not a normal API. From their docs:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Stripe considers any HTTP response code in the range 200-299 as a successful delivery. &lt;strong&gt;Anything else, including 4xx and 5xx, is treated as a failure and Stripe will retry.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So our chain was:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;DB has integrity gap for one customer&lt;/li&gt;
&lt;li&gt;Handler can't find the record&lt;/li&gt;
&lt;li&gt;Handler throws &lt;code&gt;HttpException(400)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Stripe sees 4xx 竊・schedules retry (exponential backoff)&lt;/li&gt;
&lt;li&gt;Retry hits the same DB gap 竊・another 4xx 竊・another retry&lt;/li&gt;
&lt;li&gt;After 3 days, Stripe gives up 竊・emits "we'll auto-disable in 7 days" email&lt;/li&gt;
&lt;li&gt;Endpoint gets auto-disabled. Game over.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;The fix is structural&lt;/strong&gt;: webhook handlers should almost never return 4xx for application-level "data not found" cases. Log a warning, return 200, move on. The 4xx semantic doesn't fit the protocol.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trap #2: &lt;code&gt;invoice.paid&lt;/code&gt; only fires on the 1st of the month
&lt;/h2&gt;

&lt;p&gt;Why didn't we notice for 5 days?&lt;/p&gt;

&lt;p&gt;Because &lt;code&gt;invoice.paid&lt;/code&gt; is a &lt;strong&gt;subscription cycle event&lt;/strong&gt;. For a monthly subscription, it fires &lt;em&gt;once a month&lt;/em&gt;, on renewal day. So:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Day 1 of the month: 20 customers renew 竊・1 of them is broken 竊・1 failure that day&lt;/li&gt;
&lt;li&gt;Day 2-3: Stripe retries that 1 failure several times 竊・spikes our error log briefly&lt;/li&gt;
&lt;li&gt;Day 4-30: nothing happens. Logs are silent. Sentry alerts based on rolling-7-day baselines see no change.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a class of bugs I'd call &lt;strong&gt;calendar-aligned bugs&lt;/strong&gt;: they only fire on a specific day of the month, hide inside normal noise, and Sentry's "anomaly detection" can't see them because the baseline includes the spike too.&lt;/p&gt;

&lt;p&gt;For SaaS founders, the takeaway:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Daily error count alerts won't catch month-aligned failures.&lt;/li&gt;
&lt;li&gt;You need &lt;strong&gt;per-event-type success rate alerts&lt;/strong&gt; that fire on absolute thresholds, not anomaly-based ones.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The real cause: one customer with no &lt;code&gt;subscription_items&lt;/code&gt; row
&lt;/h2&gt;

&lt;p&gt;I queried prod RDS to figure out which customer was hosed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;company_groups&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;customer_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'cus_xxx'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;-- 竊・1 row (plan='starter')&lt;/span&gt;

&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;stripe_subscriptions&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;company_group_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;96&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;-- 竊・2 rows (1 active, 1 deleted)&lt;/span&gt;

&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;stripe_subscription_items&lt;/span&gt;
  &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;stripe_subscription_id&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;175&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;176&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;-- 竊・0 rows 笞・・```&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="n"&gt;endraw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="n"&gt;Zero&lt;/span&gt; &lt;span class="k"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="n"&gt;The&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="nv"&gt;`stripe_subscription_items`&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="n"&gt;endraw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;table&lt;/span&gt; &lt;span class="n"&gt;just&lt;/span&gt; &lt;span class="n"&gt;had&lt;/span&gt; &lt;span class="k"&gt;no&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;this&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="n"&gt;Probably&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;missed&lt;/span&gt; &lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="n"&gt;during&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="k"&gt;data&lt;/span&gt; &lt;span class="n"&gt;migration&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;or&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;race&lt;/span&gt; &lt;span class="n"&gt;during&lt;/span&gt; &lt;span class="n"&gt;initial&lt;/span&gt; &lt;span class="n"&gt;subscription&lt;/span&gt; &lt;span class="n"&gt;creation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="n"&gt;We&lt;/span&gt; &lt;span class="n"&gt;don&lt;/span&gt;&lt;span class="s1"&gt;'t know exactly when.

## Fix A: data repair (root cause)

Look up the actual subscription item from the Stripe Dashboard:

- subscription item ID: {% raw %}`si_xxx`
- price: `price_xxx` (ﾂ･15,000 / month)
- 竊・matches DB plan_type `starter`

Insert the missing row:



```sql
INSERT INTO stripe_subscription_items
  (stripe_subscription_id, stripe_id, plan_type, is_annual)
VALUES
  (176, '&lt;/span&gt;&lt;span class="n"&gt;sub_xxx&lt;/span&gt;&lt;span class="s1"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;starter&lt;/span&gt;&lt;span class="s1"&gt;', 0);
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click "Resend" on a failed event in Stripe Dashboard 竊・30 seconds later: &lt;strong&gt;201 OK&lt;/strong&gt; 笨・&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix B: handler robustness (preventive)
&lt;/h2&gt;

&lt;p&gt;Data repair is a per-customer band-aid. To prevent future "data integrity gap 竊・retry storm" cases, change the handler:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Before (3 places in customer.subscription.deleted and invoice.paid)&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;stripeSubscriptionItem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;HttpException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Subscription item not found.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;HttpStatus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;BAD_REQUEST&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// After&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;stripeSubscriptionItem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;warn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;`[webhook] StripeSubscriptionItem not found for sub_id=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;stripeSub&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; (stripe_id=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;subscriptionId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;), skipping plan update`&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// exits switch, returns 200&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3 throw sites in two case blocks (&lt;code&gt;customer.subscription.deleted&lt;/code&gt; and &lt;code&gt;invoice.paid&lt;/code&gt;), all replaced with &lt;code&gt;warn + break&lt;/code&gt;. Stripe sees 200, stops retrying. The plan-update side effect is skipped, which is fine because the customer's plan was already correct (we just couldn't &lt;em&gt;verify&lt;/em&gt; it via DB).&lt;/p&gt;

&lt;h2&gt;
  
  
  Verification
&lt;/h2&gt;

&lt;p&gt;After Fix A, manually triggered retry from Stripe Dashboard:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;2026-05-05T05:27:01.500Z POST /payment/webhook 201 2 Stripe/1.0
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next day, Stripe's natural retry of the remaining 20 failed events:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;2026-05-06T04:15:28.736Z POST /payment/webhook 201 2 Stripe/1.0
2026-05-06T04:17:25.577Z POST /payment/webhook 201 2 Stripe/1.0
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All clean. 5/10 auto-disable risk fully averted.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checklist for your own webhook handlers
&lt;/h2&gt;

&lt;p&gt;Borrow this if it's useful:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Are you throwing 4xx for any DB lookup miss in your webhook? 竊・consider warn + 200 instead&lt;/li&gt;
&lt;li&gt;[ ] Do you have a &lt;code&gt;default:&lt;/code&gt; case that returns 200 for unknown event types?&lt;/li&gt;
&lt;li&gt;[ ] Are you alerting on &lt;strong&gt;per-event-type success rate&lt;/strong&gt;, not just total error count? (Catches month-aligned failures)&lt;/li&gt;
&lt;li&gt;[ ] Is there a periodic batch checking referential integrity between your subscription / customer / item tables?&lt;/li&gt;
&lt;li&gt;[ ] Are your webhook signature verification failures returning 4xx (they should 窶・that's the &lt;em&gt;correct&lt;/em&gt; use of 4xx, since Stripe needs to know its retry won't help)?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The meta-lesson
&lt;/h2&gt;

&lt;p&gt;The bug here was small (a missing DB row). The damage was disproportionate because:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The protocol's "4xx = retry" semantic doesn't match REST intuition&lt;/li&gt;
&lt;li&gt;Calendar-aligned events hide inside normal logs&lt;/li&gt;
&lt;li&gt;Sentry-style anomaly detection can't see month-1 spikes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Webhook integrations are deceptively easy at first and quietly break later. Worth a half-hour audit of yours.&lt;/p&gt;




&lt;p&gt;Posting these as I find them. I run &lt;a href="https://tasteck.tech" rel="noopener noreferrer"&gt;tasteck&lt;/a&gt;, a vertical SaaS, and I've been writing about the operational side in &lt;a href="https://tasteck.tech/blog" rel="noopener noreferrer"&gt;Build-in-Public posts&lt;/a&gt; (Japanese). This is the first one I've written in English 窶・if you want more in this style, say so in the comments.&lt;/p&gt;

</description>
      <category>stripe</category>
      <category>webhook</category>
      <category>nestjs</category>
      <category>incident</category>
    </item>
  </channel>
</rss>
