Skip to content

fix: Stripe webhook delivery failures (env + handler)#46

Draft
DealPatrol wants to merge 1 commit into
mainfrom
cursor/stripe-webhook-fix-0e18
Draft

fix: Stripe webhook delivery failures (env + handler)#46
DealPatrol wants to merge 1 commit into
mainfrom
cursor/stripe-webhook-fix-0e18

Conversation

@DealPatrol
Copy link
Copy Markdown
Owner

Problem

Stripe live mode reports 22 failed deliveries to https://RepoFuse.com/api/stripe/webhook since May 15, 2026. Stripe requires HTTP 2xx; 400/500 responses count as failures.

Diagnosis

Production endpoint is reachable (not a DNS/routing issue). Probing shows:

  • Missing stripe-signature → previously returned 400 Webhook not configured (confusing — same message as missing env vars)
  • Invalid signature with env present → 400 Invalid signature (route + STRIPE_SECRET_KEY work; signing secret mismatch is the most common live failure)

Code changes

  • Separate checks for missing env vs missing signature (503 vs 400)
  • export const runtime = 'nodejs' for Stripe SDK compatibility
  • Log event.id / event.type for Vercel log correlation
  • Return 200 for unhandled event types (avoid retries on noise)
  • Document webhook setup in VERCEL_SETUP.md and .env.example

Operator checklist (required to fix live Stripe)

  1. Stripe Dashboard → Live mode → Webhooks → endpoint URL: https://repofuse.com/api/stripe/webhook
  2. Copy Signing secret (whsec_...) → Vercel ProductionSTRIPE_WEBHOOK_SECRET
  3. Ensure STRIPE_SECRET_KEY is live (sk_live_...) on Production
  4. Redeploy Vercel production
  5. Stripe → Webhook → Send test webhook → confirm 200 in Event deliveries

Testing

  • pnpm exec tsc --noEmit passes
Open in Web Open in Cursor 

- Require STRIPE_WEBHOOK_SECRET separately from signature header
- Force Node.js runtime; log event id/type for Vercel debugging
- Return 200 for unhandled event types; clearer 503 when env missing
- Document repofuse.com webhook URL and env vars in VERCEL_SETUP

Co-authored-by: Cole Collins <DealPatrol@users.noreply.github.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
repo-app-architect Ready Ready Preview, Comment May 18, 2026 8:08pm
repofuse Ready Ready Preview, Comment, Open in v0 May 18, 2026 8:08pm
v0-repo-app-architect Ready Ready Preview, Comment, Open in v0 May 18, 2026 8:08pm

Request Review

@supabase
Copy link
Copy Markdown

supabase Bot commented May 18, 2026

This pull request has been ignored for the connected project bpjftwoiosftvjvxpovz because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Copy link
Copy Markdown
Owner Author

@DealPatrol DealPatrol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants