This commit is contained in:
2025-01-18 14:32:15 +01:00
parent 00d7fe1bf1
commit 6a0820772d
3 changed files with 1 additions and 40 deletions

View File

@@ -5,15 +5,12 @@
*/ */
import { PassThrough } from 'node:stream' import { PassThrough } from 'node:stream'
import './instrument.server.mjs'
import type { AppLoadContext, EntryContext } from '@remix-run/node' import type { AppLoadContext, EntryContext } from '@remix-run/node'
import { createReadableStreamFromReadable } from '@remix-run/node' import { createReadableStreamFromReadable } from '@remix-run/node'
import { RemixServer } from '@remix-run/react' import { RemixServer } from '@remix-run/react'
import { isbot } from 'isbot' import { isbot } from 'isbot'
import { renderToPipeableStream } from 'react-dom/server' import { renderToPipeableStream } from 'react-dom/server'
import * as Sentry from '@sentry/remix'
const ABORT_DELAY = 5_000 const ABORT_DELAY = 5_000
export const handleError = Sentry.sentryHandleError
export default function handleRequest( export default function handleRequest(
request: Request, request: Request,
responseStatusCode: number, responseStatusCode: number,

View File

@@ -1,22 +0,0 @@
import * as Sentry from "@sentry/remix";
Sentry.init({
dsn: process.env.VITE_ENV_SENTRY_DSN,
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for tracing.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
// To use Sentry OpenTelemetry auto-instrumentation
// default: false
autoInstrumentRemix: true,
// Optionally capture action formData attributes with errors.
// This requires `sendDefaultPii` set to true as well.
captureActionFormDataKeys: {
key_x: true,
key_y: true,
},
// To capture action formData attributes.
sendDefaultPii: true
});

View File

@@ -11,13 +11,10 @@ import {
} from '@remix-run/react' } from '@remix-run/react'
import stylesheet from '~/tailwind.css?url' import stylesheet from '~/tailwind.css?url'
import { PropsWithChildren, useEffect } from 'react' import { PropsWithChildren, useEffect } from 'react'
import posthog from 'posthog-js'
import { captureRemixErrorBoundaryError, withSentry } from '@sentry/remix'
export const ErrorBoundary = () => { export const ErrorBoundary = () => {
const error = useRouteError() const error = useRouteError()
captureRemixErrorBoundaryError(error)
return <div>Something went wrong. Please try again later.</div> return <div>Something went wrong. Please try again later.</div>
} }
@@ -54,19 +51,8 @@ export function Layout({ children }: PropsWithChildren) {
function App() { function App() {
return ( return (
<>
<CapturePageView />
<Outlet /> <Outlet />
</>
) )
} }
export default withSentry(App) export default App
function CapturePageView() {
const location = useLocation()
useEffect(() => {
posthog.capture('$pageview')
}, [location])
return null
}