More screenshots

    Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseOpenClawOpenClaw+21 more

    Repair Webhook Replay & Delivery Bugs

    1

    Diagnose and repair webhook delivery, replay protection, retries, ordering, acknowledgement, and reconciliation.

    $8.99

    Secure checkout via Stripe

    30-day refund guarantee

    Converts to your local currency at checkout

    Security scanned
    Repair Webhook Replay & Delivery Bugs

    Repair Webhook Replay & Delivery Bugs

    Example session with this skill installed

    Our Stripe webhook handler is creating duplicate orders when Stripe retries a delivery. Here is the current Node/Express handler code. Can you fix the idempotency issue?

    • Read your context and instructions
    • Compiled the repair webhook replay

    I have analyzed the handler. The issue stems from the database insert occurring before the idempotency check is committed, creating a race condition during rapid retries.

    Webhook Idempotency Repair

    const express = require('express');
    const router = express.Router();
    const db = require('./db'); // Hypothetical DB client
    
    router.post('/webhook', async (req, res) => {
      const sig = req.headers['stripe-signature'];
      const event = req.body;
    
      // 1. Verify event identity
      const eventId = event.id;
    
      try {
        // 2. Use a transaction to ensure atomicity
        await db.transaction(async (tx) => {
          // 3. Check for existing processed event (The Invariant)
          const existing = await tx.query(
            'SELECT id FROM processed_events WHERE id = $1 FOR UPDATE',
            [eventId]
          );
    
          if (existing.length > 0) {
            console.log(`Event ${eventId} already processed. Skipping.`);
            return;
          }
    
          // 4. Business logic: Create order
          await tx.query(
            'INSERT INTO orders (user_id, amount, status) VALUES ($1, $2, $3)',
            [event.data.object.metadata.user_id, event.data.object.amount, 'paid']
          );
    
          // 5. Record event processing
          await tx.query(
            'INSERT INTO processed_events (id, processed_at) VALUES ($1, NOW())',
            [eventId]
          );
        });
    
        // 6. Acknowledge early only after durability is guaranteed
        res.json({ received: true });
      } catch (err) {
        console.error(`Webhook Error: ${err.message}`);
        // Return 4xx/5xx to trigger provider retry
        res.status(500).send('Webhook handler failed');
      }
    });
    

    Deterministic Test Plan

    Duplicate Delivery Test: Mock two concurrent requests with the same evt_123 ID. Verify the DB contains exactly one order and one processed_events record.
    2.

    Partial Failure Test: Force an error during the order insertion. Verify that the processed_events record is NOT created, allowing for a future retry.

    Next steps

    • Create the processed_events table with a primary key on id.
    • Verify your DB driver supports FOR UPDATE or equivalent row-level locking.
    • Update the Stripe webhook secret in your environment variables.

    Connects securely to your tools. The creator never sees your data.

    What you get

    Prevent duplicate actions by implementing robust idempotency keys.Repair broken signature verification and timestamp checking.Design dead-letter queues for failing webhook consumers.Handle out-of-order events in distributed state machines.

    About this skill

    Repair Webhook Replay & Delivery Bugs targets production and repository defects around diagnose and repair webhook delivery, replay protection, retries, ordering, acknowledgement, and reconciliation.. It examines signature and timestamp verification, event identity and deduplication, provider retry semantics, acknowledgement timing, out-of-order delivery handling, dead-letter and poison-event paths, consumer idempotency and side effects, reconciliation and delivery observability, then establishes one explicit repair contract and focused deterministic validation.

    The skill works from repository access or partial evidence such as snippets, logs, configuration, traces, and architecture notes. It preserves existing product/security policy, avoids invented execution claims, and keeps production systems, real credentials, and deployment outside the validation path.

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean 1 month ago

    • Passed all security checks, Safe to install

    Listed1 month ago

    What's inside

    Frequently Asked Questions