Skip to content

[Bug] Unhandled Supabase admin client absence in /api/wakatime causes 500 error and CI test failures #2233

@shauryavardhan1307

Description

@shauryavardhan1307

Problem

In app/api/wakatime/route.ts, when Supabase credentials
are not configured (local dev or CI/Playwright test suites),
supabaseAdmin.from(...) throws an error. Although wrapped
in a try/catch, it logs the exception and returns a 500
Internal Server Error instead of a clean fallback response.

This causes smoke tests to fail in CI environments where
Supabase is not configured.

Impact

  • CI/Playwright smoke tests fail with 500 errors
  • Local development without Supabase credentials breaks
  • No clean fallback for unconfigured environments

Proposed Fix

Check isSupabaseAdminAvailable at the start of the handler.
If false, return a clean fallback:

if (!isSupabaseAdminAvailable) {
  return NextResponse.json({ 
    hasData: false, 
    not_configured: true 
  }, { status: 200 });
}

File

app/api/wakatime/route.ts

I'd like to work on this fix if approved!
GSSoC '26 contributor.

Metadata

Metadata

Labels

gssoc:assignedGSSoC: Issue assigned to a contributor

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions