fix(frontend): add sentrySvelteKit Vite plugin for source map upload
Some checks failed
CI / Unit & Component Tests (pull_request) Successful in 6m19s
CI / OCR Service Tests (pull_request) Successful in 40s
CI / Backend Unit Tests (pull_request) Failing after 25m0s
CI / fail2ban Regex (pull_request) Successful in 2m13s
CI / Compose Bucket Idempotency (pull_request) Successful in 2m3s
Some checks failed
CI / Unit & Component Tests (pull_request) Successful in 6m19s
CI / OCR Service Tests (pull_request) Successful in 40s
CI / Backend Unit Tests (pull_request) Failing after 25m0s
CI / fail2ban Regex (pull_request) Successful in 2m13s
CI / Compose Bucket Idempotency (pull_request) Successful in 2m3s
Adds the sentrySvelteKit() Vite plugin as the first plugin in vite.config.ts. When SENTRY_AUTH_TOKEN is set at build time, source maps are uploaded to GlitchTip so error stack traces show original TypeScript source and line number. When SENTRY_AUTH_TOKEN is absent (CI, dev builds), upload is disabled via autoUploadSourceMaps: false — the build succeeds normally. Resolves Felix's review blocker on PR #591. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,8 @@ GLITCHTIP_SECRET_KEY=changeme-generate-a-real-secret
|
|||||||
SENTRY_DSN=
|
SENTRY_DSN=
|
||||||
# VITE_SENTRY_DSN: frontend (SvelteKit) — injected at build time via Vite
|
# VITE_SENTRY_DSN: frontend (SvelteKit) — injected at build time via Vite
|
||||||
VITE_SENTRY_DSN=
|
VITE_SENTRY_DSN=
|
||||||
|
# Sentry/GlitchTip auth token for source map upload at build time (optional)
|
||||||
|
SENTRY_AUTH_TOKEN=
|
||||||
|
|
||||||
# Production SMTP — uncomment and fill in to send real emails instead of catching them
|
# Production SMTP — uncomment and fill in to send real emails instead of catching them
|
||||||
# APP_BASE_URL=https://your-domain.example.com
|
# APP_BASE_URL=https://your-domain.example.com
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { sentrySvelteKit } from '@sentry/sveltekit';
|
||||||
import { paraglideVitePlugin } from '@inlang/paraglide-js';
|
import { paraglideVitePlugin } from '@inlang/paraglide-js';
|
||||||
import devtoolsJson from 'vite-plugin-devtools-json';
|
import devtoolsJson from 'vite-plugin-devtools-json';
|
||||||
import tailwindcss from '@tailwindcss/vite';
|
import tailwindcss from '@tailwindcss/vite';
|
||||||
@@ -33,6 +34,21 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
sentrySvelteKit({
|
||||||
|
org: 'familienarchiv',
|
||||||
|
project: 'frontend',
|
||||||
|
authToken: process.env.SENTRY_AUTH_TOKEN,
|
||||||
|
sentryUrl: (() => {
|
||||||
|
const dsn = process.env.VITE_SENTRY_DSN;
|
||||||
|
if (!dsn) return undefined;
|
||||||
|
try {
|
||||||
|
return new URL(dsn).origin;
|
||||||
|
} catch {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
})(),
|
||||||
|
autoUploadSourceMaps: !!process.env.SENTRY_AUTH_TOKEN
|
||||||
|
}),
|
||||||
tailwindcss(),
|
tailwindcss(),
|
||||||
sveltekit(),
|
sveltekit(),
|
||||||
devtoolsJson(),
|
devtoolsJson(),
|
||||||
|
|||||||
Reference in New Issue
Block a user