Skip to content

fix: suppress redundant STRIPE_WEBHOOK_SECRET warning when Stripe is unconfigured - #341

Open
driver727-pixel wants to merge 2 commits into
mainfrom
cursor/fix-stripe-webhook-warning-3e1a
Open

fix: suppress redundant STRIPE_WEBHOOK_SECRET warning when Stripe is unconfigured#341
driver727-pixel wants to merge 2 commits into
mainfrom
cursor/fix-stripe-webhook-warning-3e1a

Conversation

@driver727-pixel

@driver727-pixel driver727-pixel commented Apr 22, 2026

Copy link
Copy Markdown
Owner

Problem

The STRIPE_WEBHOOK_SECRET warning was emitted unconditionally at server startup as a console.warn, even when:

  1. STRIPE_SECRET_KEY itself was not set (redundant alongside the existing secret-key warning), or
  2. The webhook was intentionally left unconfigured since the client-side /api/verify-checkout-session endpoint already handles purchase reconciliation.

Fix

  1. Changed the independent if (!stripeWebhookSecret) to else if, so the message only appears when Stripe is actually enabled but the webhook secret is missing.
  2. Downgraded from console.warn to console.info and rewrote the message to clarify that purchases still work without webhooks — the verify-checkout-session endpoint handles the normal flow.

Before

⚠️  STRIPE_SECRET_KEY environment variable is not set — checkout sessions will be unavailable.
⚠️  STRIPE_WEBHOOK_SECRET environment variable is not set — Stripe webhooks will be unavailable.

After (no Stripe key set)

⚠️  STRIPE_SECRET_KEY environment variable is not set — checkout sessions will be unavailable.

After (Stripe key set, no webhook secret)

ℹ️  STRIPE_WEBHOOK_SECRET is not set — webhook delivery is disabled. Purchases are still verified via /api/verify-checkout-session.

Context

The Stripe webhook (/api/stripe/webhook) and the client-side verify endpoint (/api/verify-checkout-session) both call syncPurchasedTier. The webhook is a redundant safety net for edge cases (e.g. user closes browser before redirect). The verify endpoint already handles the normal checkout flow, so a missing webhook secret is a valid configuration choice, not an error.

Open in Web Open in Cursor 

cursoragent and others added 2 commits April 22, 2026 03:54
…figured

The STRIPE_WEBHOOK_SECRET warning was emitted unconditionally at startup,
even when STRIPE_SECRET_KEY itself was not set. This produced a redundant
second warning alongside the existing STRIPE_SECRET_KEY warning for users
who haven't configured Stripe at all.

Change the independent 'if' to 'else if' so the webhook-secret warning
only fires when Stripe is actually enabled (STRIPE_SECRET_KEY is present)
but the webhook secret is missing.

Co-authored-by: SP Digital <driver727@gmail.com>
Webhooks are an optional safety net — the client-side
/api/verify-checkout-session endpoint already handles purchase
reconciliation for the normal flow. A missing webhook secret is
a deliberate configuration choice, not an error, so demote the
log from console.warn to console.info and clarify that purchases
still work without it.

Co-authored-by: SP Digital <driver727@gmail.com>
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