Skip to content

Add Sentry error reporting - #45

Merged
alexgarrettsmith merged 1 commit into
mainfrom
sentry-error-reporting
Jul 30, 2026
Merged

Add Sentry error reporting#45
alexgarrettsmith merged 1 commit into
mainfrom
sentry-error-reporting

Conversation

@alexgarrettsmith

Copy link
Copy Markdown
Collaborator

No description provided.

Install sentry/sentry-laravel and report unhandled exceptions via
Integration::handles() in the exception handler.

The DSN is read from SENTRY_LARAVEL_DSN, which is left empty in
.env.example so the SDK stays inert until it's set per environment.
Tests pin the DSN to null so the suite never ships events to Sentry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@alexgarrettsmith
alexgarrettsmith merged commit a569f8a into main Jul 30, 2026
2 checks passed
@alexgarrettsmith
alexgarrettsmith deleted the sentry-error-reporting branch July 30, 2026 09:16
@github-actions

Copy link
Copy Markdown
Contributor

No changes detected between origin/main and HEAD — nothing to triage.

@github-actions

Copy link
Copy Markdown
Contributor

QA checklist — unhandled errors are now reported to Sentry

Before you start: the deployed environment needs a Sentry DSN configured and you need access to that Sentry project's Issues and Performance views; have a normal test account and a second account that is not a team member.

  • Load the landing page, the shared dashboard, and an existing feedback item as a signed-out visitor — every page renders as before, with no new error page or blank screen.
  • Sign in, submit a new piece of feedback, then vote, react and comment on it — all actions still work and the page updates as usual.
  • Trigger a real failure (ask a developer for a safe way to force a server error on the deployed environment, or hit a URL known to blow up) — the user still sees the normal error page, and within a minute a matching issue appears in the Sentry project's Issues list, tagged with the right environment.
  • Open that Sentry issue and check the details — it shows the request URL and stack trace, but no request body and no user IP address (personal data is intentionally not sent).
  • Submit the new-feedback form with the title left empty — you still get the inline validation message on the field, and no new issue shows up in Sentry for it (expected user errors should not be reported).
  • Visit a feedback URL that does not exist — you get the normal "not found" page, and it does not create a Sentry issue.
  • Signed in as the non-team account, try to open the internal team dashboard — you are still blocked (403 / redirect), and this does not create a Sentry issue.
  • Only if performance tracing has been switched on for this environment: reload a few pages, then open Sentry's Performance/Traces view — transactions appear for the pages you visited, and the /up health-check endpoint is not listed among them.

@github-actions

Copy link
Copy Markdown
Contributor

Configuration
─────────────

Required

  • Set SENTRY_LARAVEL_DSN to the production project DSN — left empty, nothing is ever sent (.env.example, config/sentry.php)

Verify

  • Decide SENTRY_TRACES_SAMPLE_RATE — unset means performance tracing is fully off (.env.example, config/sentry.php)
  • Set SENTRY_ENVIRONMENT, or confirm APP_ENV is the value you want events tagged with (config/sentry.php)
  • Leave the DSN empty in local/dev environments so they don't pollute the production project (docs/error-monitoring.md)

Recommended

  • Set SENTRY_RELEASE from the deploy (commit sha / tag) so issues are attributable to a release (config/sentry.php)
  • Confirm SENTRY_SEND_DEFAULT_PII stays unset/false, and that sql_bindings staying off is acceptable for debugging (config/sentry.php)

Dependencies & Infrastructure
─────────────────────────────

Required

  • Run composer install on deploy — six new packages (sentry/sentry-laravel, sentry/sentry, nyholm/psr7, jean85/pretty-package-versions, symfony/options-resolver, symfony/psr-http-message-bridge) (composer.json, composer.lock)
  • Create the Sentry project / organization and get its DSN — new external service dependency (composer.json, docs/error-monitoring.md)

Verify

  • Rebuild cached config (php artisan config:cache) after deploy so the new config/sentry.php is picked up (config/sentry.php)
  • Allow outbound HTTPS from the app servers and queue workers to the Sentry ingest endpoint (config/sentry.php)

Nice to confirm

  • The excimer PHP extension is only needed if you later set SENTRY_PROFILES_SAMPLE_RATE (config/sentry.php)

Operational
───────────

Verify

  • After deploy, trigger a deliberate exception and confirm it lands in Sentry — the handler is wired via Integration::handles() (bootstrap/app.php)
  • Check the Sentry quota/plan against sample_rate defaulting to 1.0 (every error sent) plus enable_metrics defaulting to true (config/sentry.php)

Nice to confirm

  • /up is in ignore_transactions, so health-check traffic won't appear as transactions (config/sentry.php)
  • Test runs are safe: phpunit.xml pins SENTRY_LARAVEL_DSN to null; apply the same in CI for any non-PHPUnit suites (phpunit.xml)

alexgarrettsmith added a commit that referenced this pull request Jul 30, 2026
Install sentry/sentry-laravel and report unhandled exceptions via
Integration::handles() in the exception handler.

The DSN is read from SENTRY_LARAVEL_DSN, which is left empty in
.env.example so the SDK stays inert until it's set per environment.
Tests pin the DSN to null so the suite never ships events to Sentry.
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.

1 participant