Problem
During review of PR #106, the batch reviewer identified that getUserIdFromRequest in backend/src/lib/supabase.ts was not updated as part of the env-guard fix. The function:
- Still uses the old
|| "" pattern for env vars
- Creates a fresh
createClient on every call (no singleton)
- Has zero callers in the codebase — it is dead code
Since it is exported, leaving it in place risks it being wired to a route in the future with broken behavior.
Fix
Remove getUserIdFromRequest from supabase.ts entirely. Auth is handled by requireAuth middleware (auth.ts) which already uses the singleton pattern.
Affected
Problem
During review of PR #106, the batch reviewer identified that
getUserIdFromRequestinbackend/src/lib/supabase.tswas not updated as part of the env-guard fix. The function:|| ""pattern for env varscreateClienton every call (no singleton)Since it is exported, leaving it in place risks it being wired to a route in the future with broken behavior.
Fix
Remove
getUserIdFromRequestfromsupabase.tsentirely. Auth is handled byrequireAuthmiddleware (auth.ts) which already uses the singleton pattern.Affected
fix/97-backend-supabase-env-guard