Skip to content

Commit 727cfa3

Browse files
committed
fix: configure Sentry SDK for mobile app error monitoring
1 parent 759b0d8 commit 727cfa3

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

apps/mobile/v1/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ app-example
4242
# generated native folders
4343
/ios
4444
/android
45+
46+
.env.local

apps/mobile/v1/app/_layout.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@ import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
1111
import { ThemeProvider, useTheme } from '@/src/theme';
1212
import { AppWrapper } from '@/src/components/AppWrapper';
1313
import ErrorBoundary from '@/src/components/ErrorBoundary';
14+
import * as Sentry from '@sentry/react-native';
15+
16+
Sentry.init({
17+
dsn: process.env.EXPO_PUBLIC_SENTRY_DSN,
18+
19+
// Adds more context data to events (IP address, cookies, user, etc.)
20+
// For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
21+
sendDefaultPii: true,
22+
23+
// Enable Logs
24+
enableLogs: true,
25+
26+
// Configure Session Replay
27+
replaysSessionSampleRate: 0.1,
28+
replaysOnErrorSampleRate: 1,
29+
integrations: [Sentry.mobileReplayIntegration()],
30+
31+
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
32+
// spotlight: __DEV__,
33+
});
1434

1535
const clerkPublishableKey = process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY || '';
1636

@@ -101,7 +121,7 @@ function AppContent() {
101121
);
102122
}
103123

104-
export default function RootLayout() {
124+
export default Sentry.wrap(function RootLayout() {
105125
if (__DEV__) {
106126
console.log('=== MOBILE V1 APP WITH CLERK ===');
107127
console.log('Clerk key loaded:', clerkPublishableKey ? 'YES' : 'NO');
@@ -122,4 +142,4 @@ export default function RootLayout() {
122142
</ClerkLoaded>
123143
</ClerkProvider>
124144
);
125-
}
145+
});

apps/mobile/v1/metro.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const { getSentryExpoConfig } = require("@sentry/react-native/metro");
2+
3+
const config = getSentryExpoConfig(__dirname);
4+
5+
module.exports = config;

0 commit comments

Comments
 (0)