Skip to content

[Bug]: Add Error Handling for OAuth Provider Failures in Frontend #295

@Suvam-paul145

Description

@Suvam-paul145

Summary:

  • Wrap OAuth provider calls in try/catch and return a structured error when the provider is unreachable.
  • Show a user-friendly message in the UI when sign in fails due to provider unavailability.
  • Add unit tests for the failure path and an e2e test for UI behavior.

Files changed:

  • frontend/src/lib/server/auth.ts
  • frontend/src/components/SignInButton.tsx (or equivalent)
  • tests/unit/auth.spec.ts
  • tests/e2e/auth-provider-failure.spec.ts

Why:

  • Prevents frontend crashes/hangs when third-party auth services are down.
  • Improves UX and observability.

How tested:

  • Unit tests added for provider failure and 5xx responses.
  • Playwright e2e simulating provider downtime and asserting the error toast.

Notes:

  • Logging added but no sensitive data is recorded.
  • Telemetry hook included; configure Sentry/monitoring DSN as needed.

Checklist:

  • Wrap provider calls in try/catch and return structured error response
  • Return HTTP 502 with OAUTH_PROVIDER_UNAVAILABLE / OAUTH_PROVIDER_ERROR
  • Show readable error message in UI
  • Add unit tests
  • Add e2e test
  • Add telemetry/logging statement

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions