{"record":{"id":"9d8c35a5946c07be","repo":"Stirling-Tools/Stirling-PDF","slug":"supabase-is-not-configured-checkout-is-not-availa","errorCode":null,"errorMessage":"Supabase is not configured. Checkout is not available.","messagePattern":"Supabase is not configured\\. Checkout is not available\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/editor/src/proprietary/services/licenseService.ts","lineNumber":339,"sourceCode":"        yearly: enterpriseYearly || null,\n        features: (enterpriseMonthly || enterpriseYearly)!.features,\n        highlights: (enterpriseMonthly || enterpriseYearly)!.highlights,\n        popular: false,\n      });\n    }\n\n    return groups;\n  },\n\n  /**\n   * Create a Stripe checkout session for upgrading\n   */\n  async createCheckoutSession(\n    request: CheckoutSessionRequest,\n  ): Promise<CheckoutSessionResponse> {\n    // Check if Supabase is configured\n    if (!isSupabaseConfigured || !supabase) {\n      throw new Error(\"Supabase is not configured. Checkout is not available.\");\n    }\n\n    // Detect if HTTPS is available to determine checkout mode\n    const checkoutMode = getCheckoutMode();\n    const baseUrl = window.location.origin;\n    const settingsUrl = `${baseUrl}/settings/adminPlan`;\n\n    const { data, error } = await supabase.functions.invoke(\"create-checkout\", {\n      body: {\n        self_hosted: true,\n        lookup_key: request.lookup_key,\n        installation_id: request.installation_id,\n        current_license_key: request.current_license_key,\n        requires_seats: request.requires_seats,\n        seat_count: request.seat_count || 1,\n        email: request.email,\n        callback_base_url: baseUrl,\n        ui_mode: checkoutMode,","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/Stirling-Tools/Stirling-PDF/blob/9ef20dcab80b85041912f045e17a6aea1d08f969/frontend/editor/src/proprietary/services/licenseService.ts#L321-L357","documentation":"Thrown by createCheckoutSession when Supabase isn't configured. Stripe checkout sessions are created via the Supabase edge function create-checkout, so without Supabase the operation is fundamentally unavailable. The guard fails fast with a message naming the missing capability so the UI can hide/disable the upgrade flow.","triggerScenarios":"User clicks 'Upgrade' in a self-hosted build without Supabase env vars; isSupabaseConfigured is false because the client module wasn't initialized; calling createCheckoutSession from a build flavor that omits Supabase.","commonSituations":"Self-hosted deploy missing VITE_SUPABASE_URL/KEY; dev environment without Supabase configured; the upgrade button rendered despite the licensing backend being unavailable.","solutions":["Gate the upgrade/checkout UI on isSupabaseConfigured so the action can't be attempted.","Set the Supabase env vars in the active .env layer to enable checkout.","Catch the error and show a 'checkout unavailable in this mode' message instead of crashing."],"exampleFix":"// before\nconst { url } = await licenseService.createCheckoutSession(req);\n\n// after\nif (!isSupabaseConfigured) {\n  showToast(t('license.checkoutUnavailable'));\n  return;\n}\nconst { url } = await licenseService.createCheckoutSession(req);","handlingStrategy":"validation","validationCode":"if (!isSupabaseConfigured) {\n  showToast(t('license.checkoutUnavailable'));\n  return;\n}","typeGuard":"export function canCreateCheckout(): boolean {\n  return isSupabaseConfigured;\n}","tryCatchPattern":"try {\n  await licenseService.createCheckoutSession(req);\n} catch (e) {\n  if (/not configured/i.test(e instanceof Error ? e.message : \"\")) {\n    showToast(t('license.checkoutUnavailable'));\n  } else throw e;\n}","preventionTips":["Gate the upgrade button on isSupabaseConfigured.","Set Supabase env vars in builds that need checkout.","Hide licensing UI entirely in flavors that omit Supabase."],"tags":["supabase","stripe","checkout","license","configuration","proprietary","typescript"],"backgroundTag":null,"analyzedSha":"9ef20dcab80b85041912f045e17a6aea1d08f969","analyzedAt":"2026-08-13T22:11:39.827Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}