Problem
In app/api/metrics/repos/route.ts, the query to
supabaseAdmin.from("user_github_accounts") is placed
OUTSIDE the try/catch block (which starts at line 325).
If Supabase is unavailable or offline, this throws an
unhandled exception that crashes the route and returns
a generic 500 error instead of a structured error
response like other database-dependent endpoints.
Impact
- Route crashes with unhandled exception when Supabase
is unavailable
- Returns generic 500 instead of structured 502 error
- Inconsistent error handling compared to other endpoints
Proposed Fix
Move the user_github_accounts query inside the
existing try/catch block:
try {
// Move this inside:
const { data: accountData } = await supabaseAdmin
.from("user_github_accounts")
.select(...)
// ... rest of existing try block
} catch (error) {
return NextResponse.json(
{ error: "Database unavailable" },
{ status: 502 }
);
}
File
app/api/metrics/repos/route.ts — line ~325
I'd like to work on this fix if approved!
GSSoC '26 contributor.
Problem
In
app/api/metrics/repos/route.ts, the query tosupabaseAdmin.from("user_github_accounts")is placedOUTSIDE the try/catch block (which starts at line 325).
If Supabase is unavailable or offline, this throws an
unhandled exception that crashes the route and returns
a generic 500 error instead of a structured error
response like other database-dependent endpoints.
Impact
is unavailable
Proposed Fix
Move the
user_github_accountsquery inside theexisting try/catch block:
File
app/api/metrics/repos/route.ts— line ~325I'd like to work on this fix if approved!
GSSoC '26 contributor.