Add Sentry source maps and release tracking

- @sentry/vite-plugin uploads source maps during Docker build
- Release tagged with git SHA (SENTRY_RELEASE) on both client and server
- Environment set to production/development for filtering
- CD passes SENTRY_AUTH_TOKEN + SENTRY_RELEASE as Docker build args
- docker-compose passes SENTRY_RELEASE to runtime containers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-03-25 02:43:28 +01:00
parent 1a655d328f
commit 091fc0a4bd
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9
12 changed files with 290 additions and 2 deletions

View file

@ -14,6 +14,8 @@ COPY packages/db/package.json packages/db/
RUN pnpm install --frozen-lockfile
FROM base AS build
ARG SENTRY_AUTH_TOKEN
ARG SENTRY_RELEASE
COPY --from=deps /app/ ./
COPY . .
RUN pnpm --filter @trails-cool/planner build

View file

@ -6,6 +6,7 @@ import { HydratedRouter } from "react-router/dom";
Sentry.init({
dsn: "https://5215134cd78d5e6c199e29300b8425af@o4509530546634752.ingest.de.sentry.io/4511102546608208",
integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()],
environment: import.meta.env.PROD ? "production" : "development",
tracesSampleRate: 0.1,
replaysSessionSampleRate: 0,
replaysOnErrorSampleRate: 1.0,

View file

@ -7,6 +7,8 @@ import { setupYjsWebSocket } from "./app/lib/yjs-server.ts";
Sentry.init({
dsn: "https://5215134cd78d5e6c199e29300b8425af@o4509530546634752.ingest.de.sentry.io/4511102546608208",
release: process.env.SENTRY_RELEASE,
environment: process.env.NODE_ENV ?? "development",
tracesSampleRate: 0.1,
enabled: process.env.NODE_ENV === "production",
});

View file

@ -1,11 +1,25 @@
import { reactRouter } from "@react-router/dev/vite";
import { sentryVitePlugin } from "@sentry/vite-plugin";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite";
import path from "node:path";
import { yjsDevPlugin } from "./app/lib/vite-yjs-plugin.ts";
export default defineConfig({
plugins: [tailwindcss(), reactRouter(), yjsDevPlugin()],
build: {
sourcemap: true,
},
plugins: [
tailwindcss(),
reactRouter(),
yjsDevPlugin(),
sentryVitePlugin({
org: "trails-qq",
project: "planner",
release: { name: process.env.SENTRY_RELEASE },
disable: !process.env.SENTRY_AUTH_TOKEN,
}),
],
resolve: {
alias: {
"~": path.resolve(__dirname, "./app"),