From d75bf5d8a6494cfd3bb27210549f922953b2eae7 Mon Sep 17 00:00:00 2001 From: nishal77 Date: Fri, 31 Jul 2026 19:24:40 +0530 Subject: [PATCH] fix(webapp): guard Stripe init against empty publishable key loadStripe() was called unconditionally with globalEnv.publicStripeKey, which is an empty string on self-hosted/local instances with no Stripe key configured. Stripe.js throws for an empty string instead of resolving null, causing an uncaught promise rejection on every page load - including pre-auth pages like /signin - plus real network beacons fired to stripe.com before any login. Guard the call so stripePromise resolves to null when unconfigured. Downstream consumers already handle this: Plans.tsx has an existing `if (!stripe)` guard, and Stripe's accepts a null-resolving promise by design. --- packages/webapp/src/utils/stripe.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webapp/src/utils/stripe.ts b/packages/webapp/src/utils/stripe.ts index 30acc4c2ee..a500b8e875 100644 --- a/packages/webapp/src/utils/stripe.ts +++ b/packages/webapp/src/utils/stripe.ts @@ -5,5 +5,5 @@ import { globalEnv } from './env'; import type { StripeError } from '@stripe/stripe-js'; const stripePublishableKey = globalEnv.publicStripeKey; -export const stripePromise = loadStripe(stripePublishableKey); +export const stripePromise = stripePublishableKey ? loadStripe(stripePublishableKey) : Promise.resolve(null); export type { StripeError };