Skip to content

Add Bugsnag error reporting to the API app#363

Merged
gesteves merged 1 commit into
mainfrom
claude/bugsnag-api-integration-m963ej
Jun 11, 2026
Merged

Add Bugsnag error reporting to the API app#363
gesteves merged 1 commit into
mainfrom
claude/bugsnag-api-integration-m963ej

Conversation

@gesteves

Copy link
Copy Markdown
Owner

What

Adds Bugsnag error reporting to the api/ Rails app so unhandled exceptions are reported from the fly.io origin.

Changes

  • api/Gemfile — adds gem "bugsnag" (and Gemfile.lock).
  • api/config/initializers/bugsnag.rb — configures the API key from BUGSNAG_API_KEY and limits notify_release_stages to production.
  • api/.env.example — documents the new optional BUGSNAG_API_KEY.
  • api/CLAUDE.md — documents the integration in the Architecture and Environment-variables sections.

How it works

The bugsnag gem's railtie auto-inserts its Rack middleware and hooks ActionDispatch's exception handling, so exceptions are captured even though this API renders errors as plain text via lib/plain_text_exceptions.rb (verified Bugsnag::Rack is present in the middleware stack on boot).

notify_release_stages is limited to production, and BUGSNAG_API_KEY is unset locally and in CI, so reporting is a no-op outside production — safe to merge and deploy before the fly secret is set, then activate by setting BUGSNAG_API_KEY.

Verification

  • bundle exec rspec416 examples, 0 failures
  • brakeman -q0 security warnings
  • bundle-audit check --updateno vulnerabilities (incl. the new gem)
  • App boots; the initializer applies (notify_release_stages == ["production"]) and Bugsnag::Rack is in the middleware stack.

https://claude.ai/code/session_014eqFqXhv14cDRUJ8JsukGc


Generated by Claude Code

Wire the bugsnag gem with a production-only configuration so unhandled
exceptions are reported from fly.io. The gem's railtie auto-inserts its
Rack middleware and hooks ActionDispatch, so exceptions are captured even
though the API renders errors as plain text. notify_release_stages is
limited to production and BUGSNAG_API_KEY is unset locally/in CI, making
it a no-op outside production.
@netlify

netlify Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploy Preview for giventotri canceled.

Name Link
🔨 Latest commit 5412e80
🔍 Latest deploy log https://app.netlify.com/projects/giventotri/deploys/6a2b46585481df00083e7097

@gesteves gesteves merged commit 1ed8021 into main Jun 11, 2026
8 checks passed
@gesteves gesteves deleted the claude/bugsnag-api-integration-m963ej branch June 11, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants