Ticket: HEL-687
Date: 2026-04-08
Cast amount and total_hours to numeric in the HubSpot deals source query. Every column in hubspot_deals.parquet is VARCHAR — DuckDB WASM can't SUM() or AVG() text, so all Growth page queries that aggregate deal values error out silently and never resolve.
sources/hubspot/hubspot_deals.js runs SELECT * against Supabase's next_hubspot_deals table, which stores numeric fields as text. The parquet gets written with all VARCHAR types. Browser DuckDB then fails with:
Binder Error: No function matches the given name and argument types 'sum(VARCHAR)'
Confirmed in production growth container logs — onboarding_status_summary and pipeline_kpis both error on every page load. All charts and KPI tiles on Growth pages either hang or show no data.
Edit sources/hubspot/hubspot_deals.js — replace SELECT * with explicit column list, casting numeric fields:
SELECT
deal_id,
deal_name,
deal_stage_id,
pipeline_id,
amount::numeric AS amount,
close_date,
create_date,
owner_id,
onboarding_status,
assigned_counselor,
plan_name,
service_type,
graduation_year,
hours_counseling::numeric AS hours_counseling,
hours_essay::numeric AS hours_essay,
hours_tutoring::numeric AS hours_tutoring,
total_amount::numeric AS total_amount,
total_hours::numeric AS total_hours,
begin_date,
date_onboard_completed,
orientation_date,
consult_date,
sent_to_onboarding,
counselor_on_portal,
contract_signed,
lead_source,
referral_source,
initial_source,
closed_won_reason,
closed_lost_reason,
notes_for_advisor,
notes_for_counselor,
pfa_id,
synced_at
FROM next_hubspot_deals
ORDER BY create_date DESC NULLS LAST
No page changes needed — the fix is entirely at the source level.
sources/hubspot/hubspot_deals.js — replace SELECT * with explicit cast queryhubspot_pipelines — no numeric aggregation, all columns are correctly used as texthubspot_deals.parquet has amount as DOUBLE, total_hours as DOUBLEnpm run build passes clean