Skip to content

Commit f475f88

Browse files
committed
feat: Enhance Sentry integration with runtime config and add client sourcemaps
1 parent 31f2a0c commit f475f88

File tree

4 files changed

+32
-67
lines changed

4 files changed

+32
-67
lines changed

apps/web/nuxt.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export default defineNuxtConfig({
4747
pages: true,
4848
srcDir: 'src',
4949
debug: !!process.env.DEBUG,
50+
// Generate client sourcemaps for clearer stack traces in Sentry
51+
sourcemap: { client: 'hidden' },
5052
devServer: {
5153
port: 3000,
5254
...sslCfg,
@@ -88,6 +90,9 @@ export default defineNuxtConfig({
8890
'nuxt-monaco-editor',
8991
...setupApp(),
9092
],
93+
sentry: {
94+
// autoInjectServerSentry: "top-level-import",
95+
},
9196
auth: {
9297
globalMiddleware: true,
9398
rewriteRedirects: true,

apps/web/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"generate": "nuxt generate",
1111
"preview": "nuxt preview",
1212
"postinstall": "nuxt prepare",
13-
"start": "node .output/server/index.mjs",
13+
"start": "node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs",
1414
"start:prod": "node start.mjs",
1515
"lint": "eslint .",
1616
"lint:fix": "eslint --ext .ts,.js,.vue --ignore-path .gitignore . --fix"
@@ -25,6 +25,7 @@
2525
"@nyariv/sandboxjs": "^0.8.25",
2626
"@pinia/nuxt": "^0.11.2",
2727
"@quasar/extras": "^1.17.0",
28+
"@sentry/nuxt": "^10.25.0",
2829
"@vueuse/router": "^13.9.0",
2930
"ajv": "^8.17.1",
3031
"ajv-errors": "^3.0.0",
@@ -71,4 +72,4 @@
7172
"string-width": "^1.0.2 || 2 || 3 || 4"
7273
},
7374
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
74-
}
75+
}

apps/web/sentry.client.config.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
import * as Sentry from '@sentry/nuxt'
2+
import { useRuntimeConfig } from '#imports'
3+
4+
const runtimeConfig = useRuntimeConfig()
5+
26
Sentry.init({
3-
dsn: process.env.SESAME_SENTRY_DSN!,
7+
// Prefer the Nuxt runtime config for client-side DSN access
8+
dsn: runtimeConfig.public?.sentry?.dsn,
9+
10+
// Attach basic user context (IP/headers) when available
411
sendDefaultPii: true,
5-
});
12+
13+
// Performance: capture a sample of transactions (adjust in production)
14+
tracesSampleRate: 1.0,
15+
16+
// Session Replay: capture 10% of sessions and 100% on error
17+
replaysSessionSampleRate: 0.1,
18+
replaysOnErrorSampleRate: 1.0,
19+
20+
// Browser Console logs to Sentry (verbose in dev only)
21+
enableLogs: process.env.NODE_ENV === 'development',
22+
23+
// Enable Replay
24+
integrations: [Sentry.replayIntegration()],
25+
})
26+
27+
console.log('Sentry client initialized with DSN:', runtimeConfig.public?.sentry?.dsn)

apps/web/src/server/routes/api/core/backends/sse.get.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)