Skip to content

Commit 53e51a8

Browse files
committed
Avoids capturing false-positive 404 pages when building the 404 page
1 parent cdb9243 commit 53e51a8

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/app/components/MultiversalAppBootstrap.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,13 @@ const MultiversalAppBootstrap: React.FunctionComponent<Props> = (props): JSX.Ele
302302
});
303303
}
304304
} else {
305-
// XXX Opinionated: Record an exception in Sentry for 404, if you don't want this then uncomment the below code
306-
const err = new Error(`Page not found (404) for "${router?.asPath}"`);
305+
if (!process.env.IS_SERVER_INITIAL_BUILD) { // Avoids capturing false-positive 404 pages when building the 404 page
306+
// XXX Opinionated: Record an exception in Sentry for 404, if you don't want this then uncomment the below code
307+
const err = new Error(`Page not found (404) for "${router?.asPath}"`);
307308

308-
logger.warn(err);
309-
Sentry.captureException(err);
309+
logger.warn(err);
310+
Sentry.captureException(err);
311+
}
310312
}
311313

312314
const i18nextInstance: i18n = i18nextLocize(lang, i18nTranslations); // Apply i18next configuration with Locize backend

src/modules/core/sentry/init.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ if (process.env.SENTRY_DSN) {
4444
scope.setTag('nodejsAWS', process.env.AWS_EXECUTION_ENV || null); // Optional - Available on production environment only
4545
scope.setTag('memory', process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE || null); // Optional - Available on production environment only
4646
scope.setTag('runtimeEngine', isBrowser() ? 'browser' : 'server');
47+
scope.setTag('isServerInitialBuild', process.env.IS_SERVER_INITIAL_BUILD || '0');
4748
});
4849
} else {
4950
if (process.env.NODE_ENV !== 'test') {

0 commit comments

Comments
 (0)