feat: support sentry report (#1729)

This commit is contained in:
Himself65 2023-03-28 14:06:16 -05:00 committed by GitHub
parent c87aad436f
commit c9318d3790
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 349 additions and 19 deletions

View File

@ -16,3 +16,7 @@ ENABLE_BC_PROVIDER=1
EXPOSE_INTERNAL=1
ENABLE_DEBUG_PAGE=
ENABLE_SUBPAGE=
# Sentry
SENTRY_AUTH_TOKEN=
NEXT_PUBLIC_SENTRY_DSN=

View File

@ -3,6 +3,7 @@ import { createRequire } from 'node:module';
import path from 'node:path';
import { PerfseePlugin } from '@perfsee/webpack';
import { withSentryConfig } from '@sentry/nextjs';
import debugLocal from 'next-debug-local';
import preset from './preset.config.mjs';
@ -45,6 +46,9 @@ const getRedirectConfig = profile => {
/** @type {import('next').NextConfig} */
const nextConfig = {
sentry: {
hideSourceMaps: true,
},
productionBrowserSourceMaps: true,
compiler: {
styledComponents: true,
@ -158,4 +162,14 @@ const detectFirebaseConfig = () => {
};
detectFirebaseConfig();
export default withDebugLocal(nextConfig);
let config = withDebugLocal(nextConfig);
if (process.env.SENTRY_AUTH_TOKEN) {
config = withSentryConfig(config, {
silent: true,
});
} else {
console.log('Sentry not enabled, please set SENTRY_AUTH_TOKEN to enable it');
}
export default config;

View File

@ -24,6 +24,7 @@
"@emotion/server": "^11.10.0",
"@emotion/styled": "^11.10.6",
"@mui/material": "^5.11.13",
"@sentry/nextjs": "^7.45.0",
"cmdk": "^0.2.0",
"css-spring": "^4.1.0",
"dayjs": "^1.11.7",

View File

@ -0,0 +1,8 @@
import * as Sentry from '@sentry/nextjs';
const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN;
Sentry.init({
dsn: SENTRY_DSN,
tracesSampleRate: 1.0,
});

View File

@ -0,0 +1,8 @@
import * as Sentry from '@sentry/nextjs';
const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN;
Sentry.init({
dsn: SENTRY_DSN,
tracesSampleRate: 1.0,
});

View File

@ -0,0 +1,4 @@
defaults.url=https://sentry.io/
defaults.org=
defaults.project=
cli.executable=../../node_modules/@sentry/cli/bin/sentry-cli

View File

@ -0,0 +1,8 @@
import * as Sentry from '@sentry/nextjs';
const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN;
Sentry.init({
dsn: SENTRY_DSN,
tracesSampleRate: 1.0,
});

View File

@ -0,0 +1,15 @@
import * as Sentry from '@sentry/nextjs';
import type { NextPageContext } from 'next';
import type { ErrorProps } from 'next/error';
import NextErrorComponent from 'next/error';
const CustomErrorComponent = (props: ErrorProps) => {
return <NextErrorComponent statusCode={props.statusCode} />;
};
CustomErrorComponent.getInitialProps = async (contextData: NextPageContext) => {
await Sentry.captureUnderscoreErrorException(contextData);
return NextErrorComponent.getInitialProps(contextData);
};
export default CustomErrorComponent;

304
yarn.lock
View File

@ -188,6 +188,7 @@ __metadata:
"@perfsee/webpack": ^1.5.0
"@redux-devtools/extension": ^3.2.5
"@rich-data/viewer": ^2.2.4
"@sentry/nextjs": ^7.45.0
"@swc-jotai/debug-label": ^0.0.9
"@swc-jotai/react-refresh": ^0.0.7
"@types/react": ^18.0.28
@ -4390,6 +4391,25 @@ __metadata:
languageName: node
linkType: hard
"@rollup/plugin-commonjs@npm:24.0.0":
version: 24.0.0
resolution: "@rollup/plugin-commonjs@npm:24.0.0"
dependencies:
"@rollup/pluginutils": ^5.0.1
commondir: ^1.0.1
estree-walker: ^2.0.2
glob: ^8.0.3
is-reference: 1.2.1
magic-string: ^0.27.0
peerDependencies:
rollup: ^2.68.0||^3.0.0
peerDependenciesMeta:
rollup:
optional: true
checksum: e2a1bf295bbb45ab56747f7ce636d4b94046bfecc758a64c7276823b80271e0ba1196642c232aa61d1b1a98abeaddad45486c7227ec19a97d19d16f7661d49a6
languageName: node
linkType: hard
"@rollup/pluginutils@npm:^4.2.0":
version: 4.2.1
resolution: "@rollup/pluginutils@npm:4.2.1"
@ -4400,6 +4420,22 @@ __metadata:
languageName: node
linkType: hard
"@rollup/pluginutils@npm:^5.0.1":
version: 5.0.2
resolution: "@rollup/pluginutils@npm:5.0.2"
dependencies:
"@types/estree": ^1.0.0
estree-walker: ^2.0.2
picomatch: ^2.3.1
peerDependencies:
rollup: ^1.20.0||^2.0.0||^3.0.0
peerDependenciesMeta:
rollup:
optional: true
checksum: edea15e543bebc7dcac3b0ac8bc7b8e8e6dbd46e2864dbe5dd28072de1fbd5b0e10d545a610c0edaa178e8a7ac432e2a2a52e547ece1308471412caba47db8ce
languageName: node
linkType: hard
"@rushstack/eslint-patch@npm:^1.1.3":
version: 1.2.0
resolution: "@rushstack/eslint-patch@npm:1.2.0"
@ -4407,6 +4443,167 @@ __metadata:
languageName: node
linkType: hard
"@sentry-internal/tracing@npm:7.45.0":
version: 7.45.0
resolution: "@sentry-internal/tracing@npm:7.45.0"
dependencies:
"@sentry/core": 7.45.0
"@sentry/types": 7.45.0
"@sentry/utils": 7.45.0
tslib: ^1.9.3
checksum: 64cb8ddca80d4c3a8b7d7fab8ebfc38e5eeb56753b72fc7fbcc6003a190f0492fe89075f7e7d7a2621f4746c52613c79eec2695368cc44da134b0be42bd0f71b
languageName: node
linkType: hard
"@sentry/browser@npm:7.45.0":
version: 7.45.0
resolution: "@sentry/browser@npm:7.45.0"
dependencies:
"@sentry-internal/tracing": 7.45.0
"@sentry/core": 7.45.0
"@sentry/replay": 7.45.0
"@sentry/types": 7.45.0
"@sentry/utils": 7.45.0
tslib: ^1.9.3
checksum: 6f9328e32fbe92a31e891ec00f6fbd72397d6e6f9a53ec4025da8682bcb484fda49ad05ee73a95b1f0554f9a4543d9d5f40e26273eb9c70617a475939dfd29ad
languageName: node
linkType: hard
"@sentry/cli@npm:^1.74.6":
version: 1.75.0
resolution: "@sentry/cli@npm:1.75.0"
dependencies:
https-proxy-agent: ^5.0.0
mkdirp: ^0.5.5
node-fetch: ^2.6.7
progress: ^2.0.3
proxy-from-env: ^1.1.0
which: ^2.0.2
bin:
sentry-cli: bin/sentry-cli
checksum: d5b130bb45bc96d0f738801343455e6a113d1cc9e16166f0d6bfa022809b557159f010677d2dc05adcdfa7f8ad23c401182b6daef720fa2a0bad82fa6e3b2148
languageName: node
linkType: hard
"@sentry/core@npm:7.45.0":
version: 7.45.0
resolution: "@sentry/core@npm:7.45.0"
dependencies:
"@sentry/types": 7.45.0
"@sentry/utils": 7.45.0
tslib: ^1.9.3
checksum: c0453edf833b7ed86bcde6d341090bd3f4cfdb08b50a5e96cbe9d240d3955ea90c4af5550af37f95e8b987c13fa178cb004dd7bea9071145e63ce0dc7c635ec6
languageName: node
linkType: hard
"@sentry/integrations@npm:7.45.0":
version: 7.45.0
resolution: "@sentry/integrations@npm:7.45.0"
dependencies:
"@sentry/types": 7.45.0
"@sentry/utils": 7.45.0
localforage: ^1.8.1
tslib: ^1.9.3
checksum: a7a0ffb98f5568ff5ae22f4dc2b8d1a15624b124c260fb546c76c967737e25e8481bb039008d8ed13c3c9165971d12717827252a0d9129bd49e4c94090f65cf3
languageName: node
linkType: hard
"@sentry/nextjs@npm:^7.45.0":
version: 7.45.0
resolution: "@sentry/nextjs@npm:7.45.0"
dependencies:
"@rollup/plugin-commonjs": 24.0.0
"@sentry/core": 7.45.0
"@sentry/integrations": 7.45.0
"@sentry/node": 7.45.0
"@sentry/react": 7.45.0
"@sentry/types": 7.45.0
"@sentry/utils": 7.45.0
"@sentry/webpack-plugin": 1.20.0
chalk: 3.0.0
rollup: 2.78.0
stacktrace-parser: ^0.1.10
tslib: ^1.9.3
peerDependencies:
next: ^10.0.8 || ^11.0 || ^12.0 || ^13.0
react: 16.x || 17.x || 18.x
webpack: ">= 4.0.0"
peerDependenciesMeta:
webpack:
optional: true
checksum: 201e7392db27419a91de2bbc3f7d8e71c6bcaeafb4728d7aa3f09d187982c53cfecc048a07d3ee55e36f0363e51a6a00bfd907231df3ed819690f01b14a0da3b
languageName: node
linkType: hard
"@sentry/node@npm:7.45.0":
version: 7.45.0
resolution: "@sentry/node@npm:7.45.0"
dependencies:
"@sentry-internal/tracing": 7.45.0
"@sentry/core": 7.45.0
"@sentry/types": 7.45.0
"@sentry/utils": 7.45.0
cookie: ^0.4.1
https-proxy-agent: ^5.0.0
lru_map: ^0.3.3
tslib: ^1.9.3
checksum: cbe52b335419271d1e0926b28c476c590b9fb576914ed56af7b123f061d219b093a2bf1bcc9ac4131af891beb9286f5084e13575cfede9947dfa229d47a23065
languageName: node
linkType: hard
"@sentry/react@npm:7.45.0":
version: 7.45.0
resolution: "@sentry/react@npm:7.45.0"
dependencies:
"@sentry/browser": 7.45.0
"@sentry/types": 7.45.0
"@sentry/utils": 7.45.0
hoist-non-react-statics: ^3.3.2
tslib: ^1.9.3
peerDependencies:
react: 15.x || 16.x || 17.x || 18.x
checksum: 2b2a3014f85f693ac8c30af8e86e0fa843805ad123c9093d16bc89a4299f2c9942997145db8350421893e6bac3aaf18bee1633ec7a012ca02e82c07f3ddf4485
languageName: node
linkType: hard
"@sentry/replay@npm:7.45.0":
version: 7.45.0
resolution: "@sentry/replay@npm:7.45.0"
dependencies:
"@sentry/core": 7.45.0
"@sentry/types": 7.45.0
"@sentry/utils": 7.45.0
checksum: 6e960f50cb1b3fae97482edfc2458542a254af0060481e369740c1e9f93093ca662f130c400fafff092e75079929c21f59ea78d85a095b59a07250976d478b84
languageName: node
linkType: hard
"@sentry/types@npm:7.45.0":
version: 7.45.0
resolution: "@sentry/types@npm:7.45.0"
checksum: feb7de474f486f52f8f2594dc0559872c51c770b8511d90383eb4aadac8dffc2ddfb8fd7747cfd1486e629eba47bc7c9fae72fdad28cddaaeaf8dd1a52fabdfa
languageName: node
linkType: hard
"@sentry/utils@npm:7.45.0":
version: 7.45.0
resolution: "@sentry/utils@npm:7.45.0"
dependencies:
"@sentry/types": 7.45.0
tslib: ^1.9.3
checksum: 5d4d2ab4fe85d7231a35859cbeecc3d0c95368c818f15d8d6332f8c57604a67c0e12d5a81c23e5dcb1c53b4e44faf753028592792eb98e4af1440ee375b2292e
languageName: node
linkType: hard
"@sentry/webpack-plugin@npm:1.20.0":
version: 1.20.0
resolution: "@sentry/webpack-plugin@npm:1.20.0"
dependencies:
"@sentry/cli": ^1.74.6
webpack-sources: ^2.0.0 || ^3.0.0
checksum: d582026c3686f287ddc23de4e64c6f03afc2a73a84ec5a8fd3eded56a45683094bf132f4c624a35386fff872eb518771109d5c0b91a2cf79da0aff035c5bb05b
languageName: node
linkType: hard
"@sideway/address@npm:^4.1.3":
version: 4.1.4
resolution: "@sideway/address@npm:4.1.4"
@ -6386,7 +6583,7 @@ __metadata:
languageName: node
linkType: hard
"@types/estree@npm:*":
"@types/estree@npm:*, @types/estree@npm:^1.0.0":
version: 1.0.0
resolution: "@types/estree@npm:1.0.0"
checksum: 910d97fb7092c6738d30a7430ae4786a38542023c6302b95d46f49420b797f21619cdde11fa92b338366268795884111c2eb10356e4bd2c8ad5b92941e9e6443
@ -8508,6 +8705,16 @@ __metadata:
languageName: node
linkType: hard
"chalk@npm:3.0.0, chalk@npm:^3.0.0":
version: 3.0.0
resolution: "chalk@npm:3.0.0"
dependencies:
ansi-styles: ^4.1.0
supports-color: ^7.1.0
checksum: 8e3ddf3981c4da405ddbd7d9c8d91944ddf6e33d6837756979f7840a29272a69a5189ecae0ff84006750d6d1e92368d413335eab4db5476db6e6703a1d1e0505
languageName: node
linkType: hard
"chalk@npm:4.1.1":
version: 4.1.1
resolution: "chalk@npm:4.1.1"
@ -8543,16 +8750,6 @@ __metadata:
languageName: node
linkType: hard
"chalk@npm:^3.0.0":
version: 3.0.0
resolution: "chalk@npm:3.0.0"
dependencies:
ansi-styles: ^4.1.0
supports-color: ^7.1.0
checksum: 8e3ddf3981c4da405ddbd7d9c8d91944ddf6e33d6837756979f7840a29272a69a5189ecae0ff84006750d6d1e92368d413335eab4db5476db6e6703a1d1e0505
languageName: node
linkType: hard
"chalk@npm:^4.0.0, chalk@npm:^4.0.2, chalk@npm:^4.1.0, chalk@npm:^4.1.1, chalk@npm:^4.1.2":
version: 4.1.2
resolution: "chalk@npm:4.1.2"
@ -9063,7 +9260,7 @@ __metadata:
languageName: node
linkType: hard
"cookie@npm:^0.4.2":
"cookie@npm:^0.4.1, cookie@npm:^0.4.2":
version: 0.4.2
resolution: "cookie@npm:0.4.2"
checksum: a00833c998bedf8e787b4c342defe5fa419abd96b32f4464f718b91022586b8f1bafbddd499288e75c037642493c83083da426c6a9080d309e3bd90fd11baa9b
@ -10625,7 +10822,7 @@ __metadata:
languageName: node
linkType: hard
"estree-walker@npm:^2.0.1":
"estree-walker@npm:^2.0.1, estree-walker@npm:^2.0.2":
version: 2.0.2
resolution: "estree-walker@npm:2.0.2"
checksum: 6151e6f9828abe2259e57f5fd3761335bb0d2ebd76dc1a01048ccee22fabcfef3c0859300f6d83ff0d1927849368775ec5a6d265dde2f6de5a1be1721cd94efc
@ -11594,7 +11791,7 @@ __metadata:
languageName: node
linkType: hard
"glob@npm:^8.0.1, glob@npm:^8.1.0":
"glob@npm:^8.0.1, glob@npm:^8.0.3, glob@npm:^8.1.0":
version: 8.1.0
resolution: "glob@npm:8.1.0"
dependencies:
@ -12163,6 +12360,13 @@ __metadata:
languageName: node
linkType: hard
"immediate@npm:~3.0.5":
version: 3.0.6
resolution: "immediate@npm:3.0.6"
checksum: f9b3486477555997657f70318cc8d3416159f208bec4cca3ff3442fd266bc23f50f0c9bd8547e1371a6b5e82b821ec9a7044a4f7b944798b25aa3cc6d5e63e62
languageName: node
linkType: hard
"immutable@npm:^4.2.2":
version: 4.3.0
resolution: "immutable@npm:4.3.0"
@ -12570,6 +12774,15 @@ __metadata:
languageName: node
linkType: hard
"is-reference@npm:1.2.1":
version: 1.2.1
resolution: "is-reference@npm:1.2.1"
dependencies:
"@types/estree": "*"
checksum: e7b48149f8abda2c10849ea51965904d6a714193d68942ad74e30522231045acf06cbfae5a4be2702fede5d232e61bf50b3183acdc056e6e3afe07fcf4f4b2bc
languageName: node
linkType: hard
"is-regex@npm:^1.1.2, is-regex@npm:^1.1.4":
version: 1.1.4
resolution: "is-regex@npm:1.1.4"
@ -13874,6 +14087,15 @@ __metadata:
languageName: node
linkType: hard
"lie@npm:3.1.1":
version: 3.1.1
resolution: "lie@npm:3.1.1"
dependencies:
immediate: ~3.0.5
checksum: 6da9f2121d2dbd15f1eca44c0c7e211e66a99c7b326ec8312645f3648935bc3a658cf0e9fa7b5f10144d9e2641500b4f55bd32754607c3de945b5f443e50ddd1
languageName: node
linkType: hard
"lilconfig@npm:2.1.0":
version: 2.1.0
resolution: "lilconfig@npm:2.1.0"
@ -13988,6 +14210,15 @@ __metadata:
languageName: node
linkType: hard
"localforage@npm:^1.8.1":
version: 1.10.0
resolution: "localforage@npm:1.10.0"
dependencies:
lie: 3.1.1
checksum: f2978b434dafff9bcb0d9498de57d97eba165402419939c944412e179cab1854782830b5ec196212560b22712d1dd03918939f59cf1d4fc1d756fca7950086cf
languageName: node
linkType: hard
"locate-path@npm:^3.0.0":
version: 3.0.0
resolution: "locate-path@npm:3.0.0"
@ -14171,6 +14402,13 @@ __metadata:
languageName: node
linkType: hard
"lru_map@npm:^0.3.3":
version: 0.3.3
resolution: "lru_map@npm:0.3.3"
checksum: ca9dd43c65ed7a4f117c548028101c5b6855e10923ea9d1f635af53ad20c5868ff428c364d454a7b57fe391b89c704982275410c3c5099cca5aeee00d76e169a
languageName: node
linkType: hard
"lz-string@npm:^1.4.4, lz-string@npm:^1.5.0":
version: 1.5.0
resolution: "lz-string@npm:1.5.0"
@ -14585,7 +14823,7 @@ __metadata:
languageName: node
linkType: hard
"mkdirp@npm:^0.5.4":
"mkdirp@npm:^0.5.4, mkdirp@npm:^0.5.5":
version: 0.5.6
resolution: "mkdirp@npm:0.5.6"
dependencies:
@ -15843,7 +16081,7 @@ __metadata:
languageName: node
linkType: hard
"progress@npm:^2.0.1":
"progress@npm:^2.0.1, progress@npm:^2.0.3":
version: 2.0.3
resolution: "progress@npm:2.0.3"
checksum: f67403fe7b34912148d9252cb7481266a354bd99ce82c835f79070643bb3c6583d10dbcfda4d41e04bbc1d8437e9af0fb1e1f2135727878f5308682a579429b7
@ -16830,6 +17068,20 @@ __metadata:
languageName: node
linkType: hard
"rollup@npm:2.78.0":
version: 2.78.0
resolution: "rollup@npm:2.78.0"
dependencies:
fsevents: ~2.3.2
dependenciesMeta:
fsevents:
optional: true
bin:
rollup: dist/bin/rollup
checksum: 01b5a7ae082d2a14201c973ee973099f0899cc87b65063d5ca5a77c05eeefb3b51e14b1346cf1a0fc879ac2cbb87239d4f960917bfc30b7c52f5dce50a7f56e7
languageName: node
linkType: hard
"rollup@npm:^2.25.0 || >=3.3.0 < 3.20.0":
version: 3.19.1
resolution: "rollup@npm:3.19.1"
@ -17474,6 +17726,15 @@ __metadata:
languageName: node
linkType: hard
"stacktrace-parser@npm:^0.1.10":
version: 0.1.10
resolution: "stacktrace-parser@npm:0.1.10"
dependencies:
type-fest: ^0.7.1
checksum: f4fbddfc09121d91e587b60de4beb4941108e967d71ad3a171812dc839b010ca374d064ad0a296295fed13acd103609d99a4224a25b4e67de13cae131f1901ee
languageName: node
linkType: hard
"statuses@npm:2.0.1":
version: 2.0.1
resolution: "statuses@npm:2.0.1"
@ -18280,7 +18541,7 @@ __metadata:
languageName: node
linkType: hard
"tslib@npm:^1.8.1, tslib@npm:^1.9.0":
"tslib@npm:^1.8.1, tslib@npm:^1.9.0, tslib@npm:^1.9.3":
version: 1.14.1
resolution: "tslib@npm:1.14.1"
checksum: dbe628ef87f66691d5d2959b3e41b9ca0045c3ee3c7c7b906cc1e328b39f199bb1ad9e671c39025bd56122ac57dfbf7385a94843b1cc07c60a4db74795829acd
@ -18374,6 +18635,13 @@ __metadata:
languageName: node
linkType: hard
"type-fest@npm:^0.7.1":
version: 0.7.1
resolution: "type-fest@npm:0.7.1"
checksum: 5b1b113529d59949d97b76977d545989ddc11b81bb0c766b6d2ccc65473cb4b4a5c7d24f5be2c2bb2de302a5d7a13c1732ea1d34c8c59b7e0ec1f890cf7fc424
languageName: node
linkType: hard
"type-fest@npm:^0.8.0, type-fest@npm:^0.8.1":
version: 0.8.1
resolution: "type-fest@npm:0.8.1"
@ -19087,7 +19355,7 @@ __metadata:
languageName: node
linkType: hard
"webpack-sources@npm:^3.2.3":
"webpack-sources@npm:^2.0.0 || ^3.0.0, webpack-sources@npm:^3.2.3":
version: 3.2.3
resolution: "webpack-sources@npm:3.2.3"
checksum: 989e401b9fe3536529e2a99dac8c1bdc50e3a0a2c8669cbafad31271eadd994bc9405f88a3039cd2e29db5e6d9d0926ceb7a1a4e7409ece021fe79c37d9c4607