Skip to content

ERR_DB_CONNECTION_FAILED — Database Connection Failed

HTTP Status: 503 Retryable: Yes Automatic retry: None at the connection level. Individual operations like credit deduction have their own retry logic.

What the User Sees

Database is temporarily unavailable. (ERR_DB_CONNECTION_FAILED)

What Causes This Error

Supabase PostgreSQL is unreachable from the Cloudflare Worker runtime. This can be caused by: a Supabase platform outage, connection pool exhaustion on the Supabase side, the Supabase project being paused (auto-pause on free tier), or a network connectivity issue between Cloudflare Workers and Supabase’s infrastructure.

This error affects all database-dependent operations including: credit balance checks and deductions, user profile lookups, cost ledger entries, spend control enforcement, admin operations, and tenant configuration.

The error is distinguished from ERR_DB_QUERY_FAILED by the nature of the failure — connection errors mean the database is unreachable, while query errors mean the connection succeeded but the query itself failed.

Supabase projects on the free tier can auto-pause after 7 days of inactivity. This is unlikely for an active production project but can happen on staging environments.

Resolution Steps

For Users

  1. Wait a moment and try again. Database connectivity issues are usually temporary.
  2. If the error persists for more than a few minutes, the service may be experiencing an outage.
  3. Operations that do not require the database (viewing already-cached files) may still work during a database outage.

For Administrators

  1. Check https://status.supabase.com for any ongoing Supabase incidents.
  2. Check the project status in the Supabase dashboard. Verify it is not paused.
  3. Verify SUPABASE_URL and SUPABASE_SERVICE_KEY Worker secrets are correct.
  4. Test connectivity directly:
    Terminal window
    curl https://vuvwmfxssjosfphzpzim.supabase.co/rest/v1/ \
    -H "apikey: $SUPABASE_ANON_KEY" \
    -H "Authorization: Bearer $SUPABASE_ANON_KEY"
  5. If the project is paused, restore it via the Supabase dashboard or:
    Terminal window
    # Using Supabase MCP tool: restore_project with project_id vuvwmfxssjosfphzpzim
  6. If connection pool exhaustion is suspected, check the Supabase dashboard > Database > Connections for active connection count.