Merge pull request #61 from trails-cool/filter-404-from-sentry

This commit is contained in:
github-actions[bot] 2026-03-25 08:05:00 +00:00 committed by GitHub
commit b0fe60fcd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 2 deletions

View file

@ -15,6 +15,12 @@ Sentry.init({
environment: sentryEnvironment,
tracesSampleRate: 1.0,
enabled: process.env.NODE_ENV === "production" && !process.env.CI,
beforeSend(event) {
// Drop 404s — they're expected (scanners, typos), not bugs
const serialized = event.extra?.__serialized__ as Record<string, unknown> | undefined;
if (serialized?.status === 404) return null;
return event;
},
});
export const streamTimeout = 5_000;

View file

@ -123,7 +123,10 @@ export default function App({ loaderData }: Route.ComponentProps) {
}
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
Sentry.captureException(error);
// Don't report expected HTTP errors (404, 403) to Sentry
if (!(isRouteErrorResponse(error) && error.status < 500)) {
Sentry.captureException(error);
}
const { t } = useTranslation();
if (isRouteErrorResponse(error)) {

View file

@ -33,7 +33,9 @@ export default function App() {
}
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
Sentry.captureException(error);
if (!(isRouteErrorResponse(error) && error.status < 500)) {
Sentry.captureException(error);
}
const { t } = useTranslation();
if (isRouteErrorResponse(error)) {

View file

@ -13,6 +13,11 @@ Sentry.init({
environment: sentryEnvironment,
tracesSampleRate: 1.0,
enabled: process.env.NODE_ENV === "production" && !process.env.CI,
beforeSend(event) {
const serialized = event.extra?.__serialized__ as Record<string, unknown> | undefined;
if (serialized?.status === 404) return null;
return event;
},
});
const port = Number(process.env.PORT ?? 3001);