Skip to content

Auth: surface DB outage as 503 instead of 403 #377

Description

@CryptoJones

Summary

attachAuth swallows DB errors from isMaster / getCompanyId into isMaster=false / companyId=-1, which downstream handlers treat as auth failure (403). Operators may misread a Postgres outage as invalid API keys.

Proposed fix

Surface infrastructure failures as 503 when auth lookups fail due to DB errors (called out as possible future fix in auth.js comments).

Acceptance criteria

  • DB connectivity failure returns 503 on protected routes
  • Invalid/missing keys still return 403
  • Tests for both paths

Source

Code review backlog (2026-06-23)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions