diff --git a/apps/error.tsx b/apps/error.tsx deleted file mode 100644 index c72ff572..00000000 --- a/apps/error.tsx +++ /dev/null @@ -1,29 +0,0 @@ -'use client'; - -import { useEffect } from 'react'; -import * as Sentry from '@sentry/nextjs'; - -export default function GlobalError({ error }: { error: Error }) { - useEffect(() => { - const eventId = Sentry.captureException(error); - Sentry.showReportDialog({ - eventId, - title: "Something broke!", - subtitle: "Please help us fix the issue by providing some details.", - labelComments: "What happened?", - labelName: "Your name", - labelEmail: "Your email", - labelSubmit: "Send Report", - lang: "en", - }); - }, [error]); - - return ( - - -

Something went wrong

-

{error.message}

- - - ); -} \ No newline at end of file diff --git a/apps/frontend/src/app/global-error.tsx b/apps/frontend/src/app/global-error.tsx index b014f08c..db4f81eb 100644 --- a/apps/frontend/src/app/global-error.tsx +++ b/apps/frontend/src/app/global-error.tsx @@ -10,11 +10,23 @@ export default function GlobalError({ error: Error & { digest?: string }; }) { const { sentryDsn } = useVariables(); + useEffect(() => { if (!sentryDsn) { return; } - Sentry.captureException(error); + const eventId = Sentry.captureException(error); + Sentry.showReportDialog({ + eventId, + title: 'Something broke!', + subtitle: 'Please help us fix the issue by providing some details.', + labelComments: 'What happened?', + labelName: 'Your name', + labelEmail: 'Your email', + labelSubmit: 'Send Report', + lang: 'en', + }); + }, [error]); return ( diff --git a/libraries/react-shared-libraries/src/sentry/initialize.sentry.client.ts b/libraries/react-shared-libraries/src/sentry/initialize.sentry.client.ts index 416a96ef..70e626d7 100644 --- a/libraries/react-shared-libraries/src/sentry/initialize.sentry.client.ts +++ b/libraries/react-shared-libraries/src/sentry/initialize.sentry.client.ts @@ -10,9 +10,11 @@ export const initializeSentryClient = (environment: string, dsn: string) => maskAllText: true, maskAllInputs: true, }), + Sentry.feedbackIntegration({ + // Disable the injection of the default widget + autoInject: false, + }), ], - replaysSessionSampleRate: - environment === 'development' ? 1.0 : 0.1, - replaysOnErrorSampleRate: - environment === 'development' ? 1.0 : 0.1, + replaysSessionSampleRate: environment === 'development' ? 1.0 : 0.1, + replaysOnErrorSampleRate: environment === 'development' ? 1.0 : 0.1, });