Stirling-Tools/Stirling-PDF · error · Error
No pricing data returned
Error message
No pricing data returned
What it means
Thrown by usePlans.fetchPricing() when the stripe-price-lookup Supabase edge function returns a response missing the expected shape. The code requires data, data.prices, and data.missing to all be truthy; if the edge function returns null, an empty object, or a partial response, this guard fires. The preceding `if (error) throw error` handles transport-level failures, so this specifically catches a malformed success response.
Source
Thrown at frontend/editor/src/saas/hooks/usePlans.ts:85
setError(null);
const lookupKeys = [
"plan:pro",
"api:xsmall",
"api:small",
"api:medium",
"api:large",
];
const { data, error } = await supabase.functions.invoke<{
prices: Record<string, { unit_amount: number; currency: string }>;
missing: string[];
}>("stripe-price-lookup", {
body: { lookup_keys: lookupKeys, currency },
});
if (error) throw error;
if (!data || !data.prices || !data.missing)
throw new Error("No pricing data returned");
console.log("Fetched pricing data:", data);
const priceMap = new Map<
string,
{ unit_amount: number; currency: string }
>();
// map your UI keys to lookup keys (if names differ)
const keyMap: Record<string, string> = {
pro: "plan:pro",
xsmall: "api:xsmall",
small: "api:small",
medium: "api:medium",
large: "api:large",
};
for (const [uiKey, lookupKey] of Object.entries(keyMap)) {
const p = data?.prices?.[lookupKey];
if (p) {View on GitHub (pinned to 9ef20dcab8)
Solutions
- Check the stripe-price-lookup edge function logs in the Supabase dashboard for Stripe SDK errors
- Verify STRIPE_SECRET_KEY is set in the edge function's environment variables
- Confirm the lookup keys (plan:pro, api:xsmall, api:small, api:medium, api:large) exist as active prices in Stripe
- Test the edge function directly via the Supabase dashboard invoke panel with the expected body
Example fix
// before
if (!data || !data.prices || !data.missing)
throw new Error("No pricing data returned");
// after
if (!data || !data.prices || !data.missing) {
console.error("Pricing edge function returned malformed data:", data);
throw new Error(
"Pricing data unavailable. Please check edge function configuration.",
);
} Defensive patterns
Strategy: try-catch
Validate before calling
// Verify Stripe config exists before fetching pricing
if (!import.meta.env.VITE_STRIPE_PUBLISHABLE_KEY) {
console.warn('Stripe keys not configured — pricing will be unavailable');
} Type guard
function isValidPricingResponse(data: unknown): data is { prices: Record<string, { unit_amount: number; currency: string }>; missing: string[] } {
return (
typeof data === 'object' &&
data !== null &&
'prices' in data &&
'missing' in data &&
Array.isArray((data as any).missing)
);
} Try / catch
try {
await fetchPricing();
} catch (e) {
setError(e instanceof Error ? e.message : 'Pricing unavailable');
// Optionally fall back to cached/static pricing
} Prevention
- Verify STRIPE_SECRET_KEY is set in the stripe-price-lookup edge function environment
- Confirm lookup keys (plan:pro, api:xsmall, api:small, api:medium, api:large) exist in Stripe
- Test the edge function directly in the Supabase dashboard before relying on it in production
- Add monitoring/alerting on the edge function for malformed responses
When it happens
Trigger: The stripe-price-lookup edge function returns HTTP 200 but with a body that lacks the prices or missing field — e.g. returns {} on an internal error path, or returns null when no Stripe API key is configured and the function swallows the Stripe SDK error.
Common situations: STRIPE_SECRET_KEY not set in the edge function environment so the Stripe SDK call fails silently and the function returns an empty object; edge function deployed with a bug; lookup keys (plan:pro, api:xsmall, etc.) configured in Stripe but the function's response mapping is broken.
Related errors
- serverMessage || error?.message || Failed to delete account
- Edge function returned no client_secret
- data?.error ?? Portal session response missing url
- unconfigured
- Edge function ${name} failed
AI-assisted analysis of Stirling-Tools/Stirling-PDF@9ef20dcab8 (2026-08-13).
Data as JSON: /api/errors/cc27ef086e6874c4.
Report an issue: GitHub.