lay the ground work for sentry integration

This commit is contained in:
Amruth Pillai
2022-11-25 11:32:57 +01:00
parent 77c587681b
commit aec78cf875
15 changed files with 461 additions and 5 deletions
+3
View File
@@ -40,3 +40,6 @@ __ENV.js
# next-sitemap
sitemap*.xml
# sentry
.sentryclirc
+13 -1
View File
@@ -1,5 +1,6 @@
const { version } = require('../package.json');
const { i18n } = require('./next-i18next.config');
const { withSentryConfig } = require('@sentry/nextjs');
/** @type {import('next').NextConfig} */
const nextConfig = {
@@ -15,6 +16,11 @@ const nextConfig = {
domains: ['cdn.rxresu.me', 'www.gravatar.com'],
},
sentry: {
hideSourceMaps: true,
widenClientFileUpload: true,
},
// Hack to make Tailwind darkMode 'class' strategy with CSS Modules
// Ref: https://github.com/tailwindlabs/tailwindcss/issues/3258#issuecomment-968368156
webpack: (config) => {
@@ -47,4 +53,10 @@ const nextConfig = {
},
};
module.exports = nextConfig;
/** @type {import('@sentry/nextjs').SentryWebpackPluginOptions} */
const sentryConfig = {
silent: true,
dryRun: process.env.NODE_ENV !== 'production',
};
module.exports = withSentryConfig(nextConfig, sentryConfig);
+1
View File
@@ -24,6 +24,7 @@
"@next/env": "^13.0.5",
"@react-oauth/google": "^0.5.0",
"@reduxjs/toolkit": "^1.9.0",
"@sentry/nextjs": "^7.21.1",
"axios": "^1.2.0",
"clsx": "^1.2.1",
"dayjs": "^1.11.6",
+14
View File
@@ -0,0 +1,14 @@
import * as Sentry from '@sentry/nextjs';
import type { NextPage } from 'next';
import type { ErrorProps } from 'next/error';
import NextErrorComponent from 'next/error';
const CustomErrorComponent: NextPage<ErrorProps> = (props) => <NextErrorComponent statusCode={props.statusCode} />;
CustomErrorComponent.getInitialProps = async (contextData) => {
await Sentry.captureUnderscoreErrorException(contextData);
return NextErrorComponent.getInitialProps(contextData);
};
export default CustomErrorComponent;
+14
View File
@@ -0,0 +1,14 @@
import env from '@beam-australia/react-env';
import * as Sentry from '@sentry/nextjs';
const SENTRY_DSN = env('CLIENT_SENTRY_DSN');
console.log(SENTRY_DSN);
if (SENTRY_DSN) {
Sentry.init({
dsn: SENTRY_DSN,
tracesSampleRate: 1.0,
enabled: process.env.NODE_ENV === 'production',
});
}
+3
View File
@@ -0,0 +1,3 @@
defaults.url=https://sentry.io/
defaults.org=reactive-resume
defaults.project=client
+12
View File
@@ -0,0 +1,12 @@
import env from '@beam-australia/react-env';
import * as Sentry from '@sentry/nextjs';
const SENTRY_DSN = env('CLIENT_SENTRY_DSN');
if (SENTRY_DSN) {
Sentry.init({
dsn: SENTRY_DSN,
tracesSampleRate: 1.0,
enabled: process.env.NODE_ENV === 'production',
});
}