1 Commits
Author SHA1 Message Date
Najjar\NajjarV02andClaude Opus 5.5 81358b0815 fix(checkout): skip loadStripe when no publishable key is set
CI/CD / deploy (pull_request) Canceled after 0s
CI/CD / test-and-build (pull_request) Canceled after 0s
loadStripe(undefined) threw "Expected publishable key to be of type
string" on every page that imports CheckoutOverlay. Production sets the
key, so live behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 14:18:46 +04:00
+4 -1
View File
@@ -9,7 +9,10 @@ import { PaymentStep } from './checkout/PaymentStep';
import { ReviewStep } from './checkout/ReviewStep';
import { ConfirmationStep } from './checkout/ConfirmationStep';
const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!);
// Without a publishable key (local builds), loadStripe throws on every page that
// imports this module. Elements accepts null and the payment step stays empty.
const publishableKey = process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY;
const stripePromise = publishableKey ? loadStripe(publishableKey) : null;
const STEPS: { id: CheckoutStep; label: string }[] = [
{ id: 'shipping', label: 'Shipping' },