fix: throw on missing env vars in backend createServerSupabase()

🟢 open · #106 · willchen96/mike ← bmersereau/mike · opened 13d ago by bmersereau · +1,310-39 across 5 files · ↗ on GitHub

From the PR description

Summary

  • backend/src/lib/supabase.ts now throws Error("SUPABASE_URL and SUPABASE_SECRET_KEY must be set") when either env var is absent, matching the frontend fix from PR #73
  • Removes dead getUserIdFromRequest export (no callers) which still used the old || "" pattern

Closes #97 Closes #114 Closes #117 Closes #124

Changes

  • backend/src/lib/supabase.ts - replace || "" fallbacks with explicit guard; remove dead getUserIdFromRequest export
  • backend/src/lib/__tests__/supabaseServer.test.ts - new test: throws on missing URL, missing key, both missing; succeeds when both set
  • backend/vitest.config.ts - vitest configuration with include filter and isolate: true; "test" script added to package.json

Test plan

  • Unit tests added and passing (4/4)
  • Backend build passes

Our analysis

Guard Supabase env vars in the backend — read the full analysis →

Think the analysis missed something the PR description covers?

Capture this PR into my fork

Download a Markdown prompt that tells Claude how to port every commit in this PR into your working tree. Run it via claude -p < capture-pull-106.md from inside the repo you want the changes in.

⬇ Download capture-pull-106.md