You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
getSupabaseAdmin/getSupabaseClient created a new @supabase/supabase-js
client on every call (183+42 call sites, several per request). Each
client starts a GoTrue auth client (autoRefreshToken setInterval) and a
realtime client, so under steady traffic the heap grew until it hit the
--max-old-space-size cap and crashed (~18h to OOM on prod).
- Memoize both clients as module-level singletons; disable
persistSession/autoRefreshToken (no server session, kills the timer).
- Apply the same memoization to the per-request service-role clients in
the contact/waitlist/whitepaper routes.
- Bump Dockerfile heap cap 384->512MB for SSR headroom.
Session-mutating auth routes keep their own local clients, so the shared
singleton is safe. Build + 209 tests green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments