Adds Sentry and Umami monitoring to the site
Continuous Integration / lighthouse (pull_request) Canceled after 0s
Continuous Integration / deploy-test (pull_request) Canceled after 0s
Continuous Integration / deploy-production (pull_request) Canceled after 0s
Continuous Integration / check (pull_request) Canceled after 2m22s

Sentry loads after the page and reports errors only, without personal data;
Umami counts visits per environment. Both only run on andreaslop.nl and
test.andreaslop.nl. The CSP allows just these two hosts, and builds carry the
commit SHA as release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 12:08:47 +02:00
co-authored by Claude Opus 5.5
parent 0bfe50e723
commit 6d3a1566c2
20 changed files with 518 additions and 21 deletions
@@ -15,7 +15,8 @@ What to do once in each service, and what changes in the code. The code changes
|---|---|
| `package.json` | Add `@sentry/react` (same package as SlpSoftware) |
| `src/monitoring/config.ts` (new) | `sentryDsn` (from step 2) and `monitoringFor(hostname)` → `{ environment, umamiWebsiteId }` or `null` for unknown hosts (M1) |
| `src/monitoring/sentry.ts` (new) | `startSentry()`: loads `@sentry/react` dynamically after the `load` event (M4); `init` with `environment`, `release` (commit SHA from the build), `sendDefaultPii: false`, no tracing or replay. `reportError(error)`: queues errors until Sentry is ready. |
| `src/monitoring/sentry.ts` (new) | `startSentry()`: loads `@sentry/react` dynamically after the `load` event (M4); `init` with `environment`, `release` (commit SHA from the build), all `dataCollection` categories off (SDK 11 replaced `sendDefaultPii` and collects everything by default), no tracing or replay. `reportError(error)`: queues errors, including unhandled ones, until Sentry is ready. |
| `src/monitoring/sentryClient.ts` (new) | Re-exports only `init` and `captureException`, so the lazy chunk is tree-shaken (31 kB gzip instead of 150 kB). |
| `src/main.tsx` | Calls `startSentry()` |
| `src/components/StatusPage/ErrorPage.tsx` | Besides `console.error`, also `reportError(error)` (BR-ERR-03 extended) |
| `config/securityHeaders.ts` | `connect-src` + Sentry ingest host (M7); regenerated into `web.config` and nginx |
@@ -68,11 +69,12 @@ Optional: type **Keyword** with the keyword `Andrea Slop Fotografie`. That catch
- **`securityHeaders`**: the production CSP contains exactly these two external hosts, in the right directives only, and no wildcards.
- **`serverConfig`**: drift test; `web.config` and nginx contain the new CSP.
## 5. Values needed from you
Fill these in after steps 1 and 2. Placeholders are fine to start with; monitoring stays off until they are set.
## 5. Values (filled in 2026-10-19, in `src/monitoring/config.ts`)
| Value | From |
| Value | Setting |
|---|---|
| Sentry DSN | Sentry, step 1.2 |
| Umami website ID, production | Umami, step 2.3 |
| Umami website ID, test | Umami, step 2.3 |
| Sentry DSN | `https://12ec77dcc3216a98b96d3fb3dac13f66@o4511795618185216.ingest.de.sentry.io/4512282287472720` (project `andreaslop-fotografie`) |
| Umami website ID, production | `3edbb7d1-4388-4f2d-9cef-11ade88ace96` |
| Umami website ID, test | `7fb301ab-6ecc-4aea-beee-71bcb6009bfe` |
Sentry project created via the Sentry MCP. The default alert ("high priority issues") was changed to "a new issue is created" → e-mail, to match Q7 = A: handled errors from `reportError` often get a lower priority and would not have sent an e-mail.