Consolidate Sentry config into shared package; fix inconsistencies
Introduces @trails-cool/sentry-config with three helpers that encode the common Sentry.init options: - nodeSentryConfig(appContext) for the two HTTP servers - browserSentryConfig(appContext, env) for the Journal client - mobileSentryConfig(__DEV__) for the React Native app - drop404s beforeSend for servers Also fixes three inconsistencies found in the audit: - Planner server was missing sendDefaultPii: false (IPs could leak) - Planner entry.server.tsx didn't call Sentry.captureException on SSR render errors; Journal's SSR did - Sentry.init location now matches across apps (both in server.ts; Journal previously had it in app/entry.server.tsx, which meant init ran lazily on first request rather than at server startup) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4092f21475
commit
8e576ac578
13 changed files with 160 additions and 64 deletions
|
|
@ -1,22 +1,13 @@
|
|||
import * as Sentry from "@sentry/react-native";
|
||||
import { mobileSentryConfig } from "@trails-cool/sentry-config";
|
||||
|
||||
const SENTRY_DSN = "https://af50ac7aea803216adbe21e9dd4b896b@o4509530546634752.ingest.de.sentry.io/4511209742532688";
|
||||
|
||||
export function initSentry() {
|
||||
const enabled = !__DEV__;
|
||||
Sentry.init({
|
||||
dsn: SENTRY_DSN,
|
||||
tracesSampleRate: __DEV__ ? 0 : 1.0,
|
||||
enabled,
|
||||
sendDefaultPii: false,
|
||||
// Session Replay is not installed; document the intent explicitly.
|
||||
replaysSessionSampleRate: 0,
|
||||
replaysOnErrorSampleRate: 0,
|
||||
...mobileSentryConfig(__DEV__),
|
||||
});
|
||||
|
||||
if (!enabled) {
|
||||
console.debug("[sentry] mobile init inert in dev; would send to Sentry in production");
|
||||
}
|
||||
}
|
||||
|
||||
export { Sentry };
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
"@trails-cool/gpx": "workspace:*",
|
||||
"@trails-cool/i18n": "workspace:*",
|
||||
"@trails-cool/map-core": "workspace:*",
|
||||
"@trails-cool/sentry-config": "workspace:*",
|
||||
"@trails-cool/types": "workspace:*",
|
||||
"expo": "~55.0.15",
|
||||
"expo-constants": "~55.0.14",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue