Add Bugsnag error reporting to the API app#363
Merged
Conversation
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.
✅ Deploy Preview for giventotri canceled.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds Bugsnag error reporting to the
api/Rails app so unhandled exceptions are reported from the fly.io origin.Changes
api/Gemfile— addsgem "bugsnag"(andGemfile.lock).api/config/initializers/bugsnag.rb— configures the API key fromBUGSNAG_API_KEYand limitsnotify_release_stagestoproduction.api/.env.example— documents the new optionalBUGSNAG_API_KEY.api/CLAUDE.md— documents the integration in the Architecture and Environment-variables sections.How it works
The
bugsnaggem'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 vialib/plain_text_exceptions.rb(verifiedBugsnag::Rackis present in the middleware stack on boot).notify_release_stagesis limited toproduction, andBUGSNAG_API_KEYis 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 settingBUGSNAG_API_KEY.Verification
bundle exec rspec— 416 examples, 0 failuresbrakeman -q— 0 security warningsbundle-audit check --update— no vulnerabilities (incl. the new gem)notify_release_stages == ["production"]) andBugsnag::Rackis in the middleware stack.https://claude.ai/code/session_014eqFqXhv14cDRUJ8JsukGc
Generated by Claude Code