Skip to content

Commit

Permalink
Avoids capturing false-positive 404 pages when building the 404 page
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadorequest committed Jun 25, 2021
1 parent cdb9243 commit 53e51a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/app/components/MultiversalAppBootstrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,13 @@ const MultiversalAppBootstrap: React.FunctionComponent<Props> = (props): JSX.Ele
});
}
} else {
// XXX Opinionated: Record an exception in Sentry for 404, if you don't want this then uncomment the below code
const err = new Error(`Page not found (404) for "${router?.asPath}"`);
if (!process.env.IS_SERVER_INITIAL_BUILD) { // Avoids capturing false-positive 404 pages when building the 404 page
// XXX Opinionated: Record an exception in Sentry for 404, if you don't want this then uncomment the below code
const err = new Error(`Page not found (404) for "${router?.asPath}"`);

logger.warn(err);
Sentry.captureException(err);
logger.warn(err);
Sentry.captureException(err);
}
}

const i18nextInstance: i18n = i18nextLocize(lang, i18nTranslations); // Apply i18next configuration with Locize backend
Expand Down
1 change: 1 addition & 0 deletions src/modules/core/sentry/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ if (process.env.SENTRY_DSN) {
scope.setTag('nodejsAWS', process.env.AWS_EXECUTION_ENV || null); // Optional - Available on production environment only
scope.setTag('memory', process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE || null); // Optional - Available on production environment only
scope.setTag('runtimeEngine', isBrowser() ? 'browser' : 'server');
scope.setTag('isServerInitialBuild', process.env.IS_SERVER_INITIAL_BUILD || '0');
});
} else {
if (process.env.NODE_ENV !== 'test') {
Expand Down

0 comments on commit 53e51a8

Please sign in to comment.