{"record":{"id":"4d2a23ec5259fd01","repo":"Stirling-Tools/Stirling-PDF","slug":"no-pricing-data-returned","errorCode":null,"errorMessage":"No pricing data returned","messagePattern":"No pricing data returned","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/editor/src/proprietary/services/licenseService.ts","lineNumber":151,"sourceCode":"            unit_amount: number;\n            currency: string;\n            lookup_key: string;\n          }\n        >;\n        missing: string[];\n      }>(\"stripe-price-lookup\", {\n        body: {\n          lookup_keys: SELF_HOSTED_LOOKUP_KEYS,\n          currency,\n        },\n      });\n\n      if (error) {\n        throw new Error(`Failed to fetch plans: ${error.message}`);\n      }\n\n      if (!data || !data.prices) {\n        throw new Error(\"No pricing data returned\");\n      }\n\n      // Log missing prices for debugging\n      if (data.missing && data.missing.length > 0) {\n        console.warn(\n          \"Missing Stripe prices for lookup keys:\",\n          data.missing,\n          \"in currency:\",\n          currency,\n        );\n      }\n\n      // Build price map for easy access\n      const priceMap = new Map<\n        string,\n        { unit_amount: number; currency: string }\n      >();\n      for (const [lookupKey, priceData] of Object.entries(data.prices)) {","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/Stirling-Tools/Stirling-PDF/blob/9ef20dcab80b85041912f045e17a6aea1d08f969/frontend/editor/src/proprietary/services/licenseService.ts#L133-L169","documentation":"Thrown by getPlans when the stripe-price-lookup invocation succeeded (no error) but the returned data is null or has no prices field. This guards against a malformed/degenerate edge-function response — the lookup technically ran but produced nothing usable, so building plan tiers is impossible. Distinct from error 167 because there was no FunctionsError, just empty data.","triggerScenarios":"The edge function returns {} or null on success (e.g. it silently returned early); it returns {missing:[...]} with no prices because no lookup keys matched; a response-shape change in the function that dropped the prices field; the function returned a 2xx with an empty body.","commonSituations":"Edge function deployed in a mode that returns early when Stripe has no matching prices; lookup keys misconfigured so all are reported missing and prices omitted; a refactor of the function's return shape that the client hasn't caught up to.","solutions":["Log/inspect the actual returned data shape from the edge function to confirm whether prices or only missing is present.","Ensure all SELF_HOSTED_LOOKUP_KEYS have active prices in Stripe so the function returns a non-empty prices map.","Update the edge function to always return a prices object (even if empty) and check missing for diagnosis.","Fall back to static plans at the caller if dynamic pricing is optional."],"exampleFix":"// before\nif (!data || !data.prices) throw new Error(\"No pricing data returned\");\n\n// after — also log missing keys for diagnosis, then fall back\nif (!data || !data.prices) {\n  console.warn('stripe-price-lookup returned no prices', data?.missing);\n  return { plans: buildStaticPlans(features, highlights) };\n}","handlingStrategy":"fallback","validationCode":"// caller cannot pre-validate response shape; ensure keys exist in Stripe so the function returns prices","typeGuard":null,"tryCatchPattern":"try {\n  return await licenseService.getPlans(features, highlights, currency);\n} catch (e) {\n  if (/No pricing data returned/.test(e instanceof Error ? e.message : \"\")) {\n    return { plans: STATIC_PLANS };\n  }\n  throw e;\n}","preventionTips":["Keep the edge function's return shape under test so prices is always present on success.","Register every SELF_HOSTED_LOOKUP_KEYS as an active Stripe price.","Log the missing array returned by the function when prices come back empty."],"tags":["supabase","stripe","license","plans","data-integrity","proprietary","typescript"],"backgroundTag":null,"analyzedSha":"9ef20dcab80b85041912f045e17a6aea1d08f969","analyzedAt":"2026-08-13T22:11:39.827Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}