diff --git a/dev-packages/e2e-tests/test-applications/react-router-8-framework/app/entry.server.cloudflare.tsx b/dev-packages/e2e-tests/test-applications/react-router-8-framework/app/entry.server.cloudflare.tsx index 57bc9460c40c..3bf7701c6afe 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-8-framework/app/entry.server.cloudflare.tsx +++ b/dev-packages/e2e-tests/test-applications/react-router-8-framework/app/entry.server.cloudflare.tsx @@ -1,4 +1,3 @@ -import { captureException } from '@sentry/cloudflare'; import * as Sentry from '@sentry/react-router/cloudflare'; import { renderToReadableStream } from 'react-dom/server'; import { ServerRouter, type HandleErrorFunction } from 'react-router'; @@ -9,11 +8,6 @@ export default Sentry.createSentryHandleRequest({ getNonce: () => btoa(String.fromCharCode(...crypto.getRandomValues(new Uint8Array(16)))), }); -export const handleError: HandleErrorFunction = (error, { request }) => { - if (!request.signal.aborted) { - captureException(error, { mechanism: { type: 'react-router', handled: false } }); - console.error(error); - } -}; +export const handleError: HandleErrorFunction = Sentry.createSentryHandleError({ logErrors: true }); export const instrumentations = [Sentry.createSentryServerInstrumentation()]; diff --git a/packages/react-router/src/cloudflare/index.ts b/packages/react-router/src/cloudflare/index.ts index f28bb1d4924e..a0b1b2b26d0c 100644 --- a/packages/react-router/src/cloudflare/index.ts +++ b/packages/react-router/src/cloudflare/index.ts @@ -7,5 +7,6 @@ export { type CreateSentryServerInstrumentationOptions, } from '../server/createServerInstrumentation'; export { createSentryHandleRequestWebStream as createSentryHandleRequest } from '../server/createSentryHandleRequestWebStream'; +export { createSentryHandleError, type SentryHandleErrorOptions } from '../server/createSentryHandleError'; export type { SentryWebStreamHandleRequestOptions } from '../server/handleRequestTypes'; export { injectTraceMetaTags } from '../server/injectTraceMetaTags';