From a3e3c6528a5b20474e9f562e4f3abc5191a7aa55 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Thu, 21 Dec 2023 11:37:53 +0100 Subject: [PATCH 1/5] :sparkles: Installing sentry --- .gitignore | 3 + next.config.js | 43 +++ package-lock.json | 493 ++++++++++++++++++++++++++++ package.json | 1 + sentry.client.config.ts | 30 ++ sentry.edge.config.ts | 16 + sentry.server.config.ts | 15 + src/pages/_error.jsx | 17 + src/pages/api/sentry-example-api.js | 5 + src/pages/sentry-example-page.jsx | 84 +++++ tsconfig.json | 159 ++++----- 11 files changed, 773 insertions(+), 93 deletions(-) create mode 100644 sentry.client.config.ts create mode 100644 sentry.edge.config.ts create mode 100644 sentry.server.config.ts create mode 100644 src/pages/_error.jsx create mode 100644 src/pages/api/sentry-example-api.js create mode 100644 src/pages/sentry-example-page.jsx diff --git a/.gitignore b/.gitignore index b7cfee05..7519aef1 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,6 @@ yarn-error.log* next-env.d.ts node_modules id_rsa + +# Sentry Config File +.sentryclirc diff --git a/next.config.js b/next.config.js index 997db3d9..efdfe7bd 100644 --- a/next.config.js +++ b/next.config.js @@ -55,3 +55,46 @@ const nextConfig = { }; module.exports = nextConfig; + + +// Injected content via Sentry wizard below + +const { withSentryConfig } = require("@sentry/nextjs"); + +module.exports = withSentryConfig( + module.exports, + { + // For all available options, see: + // https://github.com/getsentry/sentry-webpack-plugin#options + + // Suppresses source map uploading logs during build + silent: true, + org: "smart-chain-nh", + project: "lecoffre", + }, + { + // For all available options, see: + // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ + + // Upload a larger set of source maps for prettier stack traces (increases build time) + widenClientFileUpload: true, + + // Transpiles SDK to be compatible with IE11 (increases bundle size) + transpileClientSDK: true, + + // Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load) + tunnelRoute: "/monitoring", + + // Hides source maps from generated client bundles + hideSourceMaps: true, + + // Automatically tree-shake Sentry logger statements to reduce bundle size + disableLogger: true, + + // Enables automatic instrumentation of Vercel Cron Monitors. + // See the following for more information: + // https://docs.sentry.io/product/crons/ + // https://vercel.com/docs/cron-jobs + automaticVercelMonitors: true, + } +); diff --git a/package-lock.json b/package-lock.json index 89f2f3c8..6c5e90ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", "@mui/material": "^5.11.13", + "@sentry/nextjs": "^7.90.0", "@types/node": "18.15.1", "@types/react": "18.0.28", "@types/react-dom": "18.0.11", @@ -496,6 +497,11 @@ "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==" }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" + }, "node_modules/@mui/base": { "version": "5.0.0-beta.28", "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.28.tgz", @@ -965,11 +971,317 @@ "url": "https://opencollective.com/popperjs" } }, + "node_modules/@rollup/plugin-commonjs": { + "version": "24.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-24.0.0.tgz", + "integrity": "sha512-0w0wyykzdyRRPHOb0cQt14mIBLujfAv6GgP6g8nvg/iBxEm112t3YPPq+Buqe2+imvElTka+bjNlJ/gB56TD8g==", + "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" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.68.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@rollup/pluginutils": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.0.tgz", + "integrity": "sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==", + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, "node_modules/@rushstack/eslint-patch": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.6.1.tgz", "integrity": "sha512-UY+FGM/2jjMkzQLn8pxcHGMaVLh9aEitG3zY2CiY7XHdLiz3bZOwa6oDxNqEMv7zZkV+cj5DOdz0cQ1BP5Hjgw==" }, + "node_modules/@sentry-internal/feedback": { + "version": "7.90.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-7.90.0.tgz", + "integrity": "sha512-ZIdpwK9KmiE/UYGUgNE3N9A5MWm92rbC/0u04LxQfZh0tGqN2EchwivQpFCWuu5QsKMlsza7aO6YQXsKvwt1Ww==", + "dependencies": { + "@sentry/core": "7.90.0", + "@sentry/types": "7.90.0", + "@sentry/utils": "7.90.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@sentry-internal/tracing": { + "version": "7.90.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.90.0.tgz", + "integrity": "sha512-74jEtpdio9aRkiVBcrY1ZJXek0oFMqxDJK6BkJNCA+aUK1z96V9viehANRk3Nbxm01rWjmH1U4e1siuo9FhjuQ==", + "dependencies": { + "@sentry/core": "7.90.0", + "@sentry/types": "7.90.0", + "@sentry/utils": "7.90.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/browser": { + "version": "7.90.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.90.0.tgz", + "integrity": "sha512-ik3Jwo+TYjoEesJlt3PlHDcPE9h//WwyUsVkV9ZsVx0MSXb8c1VC4uDMsyUqjA+gPImmw1l9KlWZtvaOooZEhg==", + "dependencies": { + "@sentry-internal/feedback": "7.90.0", + "@sentry-internal/tracing": "7.90.0", + "@sentry/core": "7.90.0", + "@sentry/replay": "7.90.0", + "@sentry/types": "7.90.0", + "@sentry/utils": "7.90.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/cli": { + "version": "1.77.1", + "resolved": "https://registry.npmjs.org/@sentry/cli/-/cli-1.77.1.tgz", + "integrity": "sha512-OtJ7U9LeuPUAY/xow9wwcjM9w42IJIpDtClTKI/RliE685vd/OJUIpiAvebHNthDYpQynvwb/0iuF4fonh+CKw==", + "hasInstallScript": true, + "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" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@sentry/core": { + "version": "7.90.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.90.0.tgz", + "integrity": "sha512-HolpdHjULCwehKPWHR6IPQM0NBjmORhlBU7FtCh/e8TtSkZ9ztPsuofNBomMS1+mdbL+yxOIc9KUYEl0zRfeAQ==", + "dependencies": { + "@sentry/types": "7.90.0", + "@sentry/utils": "7.90.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/integrations": { + "version": "7.90.0", + "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.90.0.tgz", + "integrity": "sha512-Eba1gbXkh08Ov/DuI/oQdi8a17lE0XMTkw2RtPrrvBWkYjdwEE0eI6Ls23BemTqm3+JNzTCPBzuJwdUq3yWbnw==", + "dependencies": { + "@sentry/core": "7.90.0", + "@sentry/types": "7.90.0", + "@sentry/utils": "7.90.0", + "localforage": "^1.8.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/nextjs": { + "version": "7.90.0", + "resolved": "https://registry.npmjs.org/@sentry/nextjs/-/nextjs-7.90.0.tgz", + "integrity": "sha512-dQwzXhTBjk3rcRRCDubl5tKzUXG8EaYQLUCxVP8cv6Q/cnWmerECZrApQ5laVRP6DOoaEoIpI1skHj64SJPlDg==", + "dependencies": { + "@rollup/plugin-commonjs": "24.0.0", + "@sentry/core": "7.90.0", + "@sentry/integrations": "7.90.0", + "@sentry/node": "7.90.0", + "@sentry/react": "7.90.0", + "@sentry/types": "7.90.0", + "@sentry/utils": "7.90.0", + "@sentry/vercel-edge": "7.90.0", + "@sentry/webpack-plugin": "1.21.0", + "chalk": "3.0.0", + "resolve": "1.22.8", + "rollup": "2.78.0", + "stacktrace-parser": "^0.1.10" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "next": "^10.0.8 || ^11.0 || ^12.0 || ^13.0 || ^14.0", + "react": "16.x || 17.x || 18.x", + "webpack": ">= 4.0.0" + }, + "peerDependenciesMeta": { + "webpack": { + "optional": true + } + } + }, + "node_modules/@sentry/nextjs/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/node": { + "version": "7.90.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.90.0.tgz", + "integrity": "sha512-VjDI2MCkidoFEzrMa1gqmwYt1sUhYnu+zoFF5P5jgapTVVJ5xc2b7k/lS62U6IsfxHNrIdTtQHsrbCS5+s0GvQ==", + "dependencies": { + "@sentry-internal/tracing": "7.90.0", + "@sentry/core": "7.90.0", + "@sentry/types": "7.90.0", + "@sentry/utils": "7.90.0", + "https-proxy-agent": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/react": { + "version": "7.90.0", + "resolved": "https://registry.npmjs.org/@sentry/react/-/react-7.90.0.tgz", + "integrity": "sha512-ixhSa3+kmmXvJkKiewLYju0FnYDE8dv8c3E1s4CNU/3SjvqCqcTBOnLzgGleixs3JVklS1JUTU2zS3cwQ2uEOw==", + "dependencies": { + "@sentry/browser": "7.90.0", + "@sentry/types": "7.90.0", + "@sentry/utils": "7.90.0", + "hoist-non-react-statics": "^3.3.2" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "react": "15.x || 16.x || 17.x || 18.x" + } + }, + "node_modules/@sentry/replay": { + "version": "7.90.0", + "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.90.0.tgz", + "integrity": "sha512-fsABtzQ5JQI7G5CC4fg05lVI5DTbd1uwKi41xVKFRmCB5NVTHvK7bHgP8n6uSbnle+gp9rUxVPLLBIPjKfaTmw==", + "dependencies": { + "@sentry-internal/tracing": "7.90.0", + "@sentry/core": "7.90.0", + "@sentry/types": "7.90.0", + "@sentry/utils": "7.90.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@sentry/types": { + "version": "7.90.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.90.0.tgz", + "integrity": "sha512-dA0Mtba5jYlcQ6xBsGILZuFq4NGrWLfr2ys036z2JE4H1+3PxOVERlD3Di7p+WKYM5gjFw10Hn3EgUV979E3dA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/utils": { + "version": "7.90.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.90.0.tgz", + "integrity": "sha512-6BpqAzONm/HQbdlL4TY2W2vBSmaG/eVvwUaHoz0wB49EkWwpF6j/SO9Kb/XkiA/qp9GoJVXpnGBFQLPx7kv/Yw==", + "dependencies": { + "@sentry/types": "7.90.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/vercel-edge": { + "version": "7.90.0", + "resolved": "https://registry.npmjs.org/@sentry/vercel-edge/-/vercel-edge-7.90.0.tgz", + "integrity": "sha512-meVUgfqCvn8wlVP/8KjggshFBW8sLCRqynO+pX2b8YO+u/kh0w8UUTC3RXy/upCzoz1wLk274/+U14z11prjlA==", + "dependencies": { + "@sentry-internal/tracing": "7.90.0", + "@sentry/core": "7.90.0", + "@sentry/types": "7.90.0", + "@sentry/utils": "7.90.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/webpack-plugin": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/@sentry/webpack-plugin/-/webpack-plugin-1.21.0.tgz", + "integrity": "sha512-x0PYIMWcsTauqxgl7vWUY6sANl+XGKtx7DCVnnY7aOIIlIna0jChTAPANTfA2QrK+VK+4I/4JxatCEZBnXh3Og==", + "dependencies": { + "@sentry/cli": "^1.77.1", + "webpack-sources": "^2.0.0 || ^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@swc/helpers": { "version": "0.4.14", "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.14.tgz", @@ -978,6 +1290,11 @@ "tslib": "^2.4.0" } }, + "node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==" + }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -1154,6 +1471,17 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -1665,6 +1993,11 @@ "node": ">= 0.8" } }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==" + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2399,6 +2732,11 @@ "node": ">=4.0" } }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" + }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -2847,6 +3185,18 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -2874,6 +3224,11 @@ "node": ">= 4" } }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" + }, "node_modules/immutable": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.4.tgz", @@ -3132,6 +3487,14 @@ "node": ">=8" } }, + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dependencies": { + "@types/estree": "*" + } + }, "node_modules/is-regex": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", @@ -3386,11 +3749,27 @@ "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.52.tgz", "integrity": "sha512-6vCuCHgem+OW1/VCAKgkasfegItCea8zIT7s9/CG/QxdCMIM7GfzbEBG5d7lGO3rzipjt5woOQL3DiHa8Fy78Q==" }, + "node_modules/lie": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", + "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==", + "dependencies": { + "immediate": "~3.0.5" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, + "node_modules/localforage": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", + "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", + "dependencies": { + "lie": "3.1.1" + } + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -3432,6 +3811,17 @@ "node": ">=10" } }, + "node_modules/magic-string": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", + "integrity": "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.13" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/memoize-one": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", @@ -3506,6 +3896,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, "node_modules/mkdirp-classic": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", @@ -3614,6 +4015,25 @@ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz", "integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==" }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -3960,6 +4380,14 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", @@ -3975,6 +4403,11 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -4245,6 +4678,20 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rollup": { + "version": "2.78.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.78.0.tgz", + "integrity": "sha512-4+YfbQC9QEVvKTanHhIAFVUFSRsezvQF8vFOJwtGfb9Bb+r014S+qryr9PSmw8x6sMnPkmFBGAvIFVQxvJxjtg==", + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -4515,6 +4962,25 @@ "node": ">=0.10.0" } }, + "node_modules/stacktrace-parser": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/stacktrace-parser/-/stacktrace-parser-0.1.10.tgz", + "integrity": "sha512-KJP1OCML99+8fhOHxwwzyWrlUuVX5GQ0ZpJTd1DFXhdkrvg1szxfHhawXUZ3g9TkXORQd4/WG68jMlQZ2p8wlg==", + "dependencies": { + "type-fest": "^0.7.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/stacktrace-parser/node_modules/type-fest": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.7.1.tgz", + "integrity": "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==", + "engines": { + "node": ">=8" + } + }, "node_modules/streamx": { "version": "2.15.6", "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.6.tgz", @@ -4724,6 +5190,11 @@ "node": ">=8.0" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "node_modules/tsconfig-paths": { "version": "3.15.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", @@ -4930,6 +5401,28 @@ "node": ">= 0.10" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 423dd9cb..9fff403e 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", "@mui/material": "^5.11.13", + "@sentry/nextjs": "^7.90.0", "@types/node": "18.15.1", "@types/react": "18.0.28", "@types/react-dom": "18.0.11", diff --git a/sentry.client.config.ts b/sentry.client.config.ts new file mode 100644 index 00000000..a21b356c --- /dev/null +++ b/sentry.client.config.ts @@ -0,0 +1,30 @@ +// This file configures the initialization of Sentry on the client. +// The config you add here will be used whenever a users loads a page in their browser. +// https://docs.sentry.io/platforms/javascript/guides/nextjs/ + +import * as Sentry from "@sentry/nextjs"; + +Sentry.init({ + dsn: "https://ca6a89e8b480c814e1b5828b8412c681@o4506382103281664.ingest.sentry.io/4506399972130816", + + // Adjust this value in production, or use tracesSampler for greater control + tracesSampleRate: 1, + + // Setting this option to true will print useful information to the console while you're setting up Sentry. + debug: false, + + replaysOnErrorSampleRate: 1.0, + + // This sets the sample rate to be 10%. You may want this to be 100% while + // in development and sample at a lower rate in production + replaysSessionSampleRate: 0.1, + + // You can remove this option if you're not planning to use the Sentry Session Replay feature: + integrations: [ + new Sentry.Replay({ + // Additional Replay configuration goes in here, for example: + maskAllText: true, + blockAllMedia: true, + }), + ], +}); diff --git a/sentry.edge.config.ts b/sentry.edge.config.ts new file mode 100644 index 00000000..397d9fa5 --- /dev/null +++ b/sentry.edge.config.ts @@ -0,0 +1,16 @@ +// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on). +// The config you add here will be used whenever one of the edge features is loaded. +// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally. +// https://docs.sentry.io/platforms/javascript/guides/nextjs/ + +import * as Sentry from "@sentry/nextjs"; + +Sentry.init({ + dsn: "https://ca6a89e8b480c814e1b5828b8412c681@o4506382103281664.ingest.sentry.io/4506399972130816", + + // Adjust this value in production, or use tracesSampler for greater control + tracesSampleRate: 1, + + // Setting this option to true will print useful information to the console while you're setting up Sentry. + debug: false, +}); diff --git a/sentry.server.config.ts b/sentry.server.config.ts new file mode 100644 index 00000000..ca8cca0e --- /dev/null +++ b/sentry.server.config.ts @@ -0,0 +1,15 @@ +// This file configures the initialization of Sentry on the server. +// The config you add here will be used whenever the server handles a request. +// https://docs.sentry.io/platforms/javascript/guides/nextjs/ + +import * as Sentry from "@sentry/nextjs"; + +Sentry.init({ + dsn: "https://ca6a89e8b480c814e1b5828b8412c681@o4506382103281664.ingest.sentry.io/4506399972130816", + + // Adjust this value in production, or use tracesSampler for greater control + tracesSampleRate: 1, + + // Setting this option to true will print useful information to the console while you're setting up Sentry. + debug: false, +}); diff --git a/src/pages/_error.jsx b/src/pages/_error.jsx new file mode 100644 index 00000000..46a61d69 --- /dev/null +++ b/src/pages/_error.jsx @@ -0,0 +1,17 @@ +import * as Sentry from "@sentry/nextjs"; +import Error from "next/error"; + +const CustomErrorComponent = (props) => { + return ; +}; + +CustomErrorComponent.getInitialProps = async (contextData) => { + // In case this is running in a serverless function, await this in order to give Sentry + // time to send the error before the lambda exits + await Sentry.captureUnderscoreErrorException(contextData); + + // This will contain the status code of the response + return Error.getInitialProps(contextData); +}; + +export default CustomErrorComponent; diff --git a/src/pages/api/sentry-example-api.js b/src/pages/api/sentry-example-api.js new file mode 100644 index 00000000..ac07eec0 --- /dev/null +++ b/src/pages/api/sentry-example-api.js @@ -0,0 +1,5 @@ +// A faulty API route to test Sentry's error monitoring +export default function handler(_req, res) { + throw new Error("Sentry Example API Route Error"); + res.status(200).json({ name: "John Doe" }); +} diff --git a/src/pages/sentry-example-page.jsx b/src/pages/sentry-example-page.jsx new file mode 100644 index 00000000..37f9530a --- /dev/null +++ b/src/pages/sentry-example-page.jsx @@ -0,0 +1,84 @@ +import Head from "next/head"; +import * as Sentry from "@sentry/nextjs"; + +export default function Page() { + return ( +
+ + Sentry Onboarding + + + +
+

+ + + +

+ +

Get started by sending us a sample error:

+ + +

+ Next, look for the error on the{" "} + Issues Page. +

+

+ For more information, see{" "} + + https://docs.sentry.io/platforms/javascript/guides/nextjs/ + +

+
+
+ ); +} diff --git a/tsconfig.json b/tsconfig.json index ae259ebf..2b625854 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,94 +1,67 @@ { - "compilerOptions": { - "incremental": false, - "target": "es5", - "module": "CommonJS", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], - "jsx": "preserve", - "sourceMap": true, - "outDir": "./dist", - "rootDir": "./src", - "noEmit": false, - "importHelpers": true, - "resolveJsonModule": true, - /* Strict Type-Checking Options */ - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "exactOptionalPropertyTypes": false, - "noImplicitOverride": true, - "strict": true, - "noImplicitAny": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "strictBindCallApply": true, - "strictPropertyInitialization": true, - "noImplicitThis": true, - "alwaysStrict": true, - "noPropertyAccessFromIndexSignature": true, - /* Additional Checks */ - "noUnusedLocals": true, - "noImplicitReturns": true, - "noUncheckedIndexedAccess": true, - "useUnknownInCatchVariables": true, - /* Module Resolution Options */ - "moduleResolution": "node", - "baseUrl": ".", - "paths": { - "@Api/*": [ - "src/api/*" - ], - "@Front/*": [ - "src/front/*" - ], - "@Assets/*": [ - "src/front/Assets/*" - ], - "@Components/*": [ - "src/front/Components/*" - ], - "@Themes/*": [ - "src/front/Themes/*" - ], - "@Stores/*": [ - "src/front/Stores/*" - ], - "@FrontServices/*": [ - "src/front/services/*" - ], - "@Page/*": [ - "src/pages/*" - ], - }, - // "rootDirs": [], - // "typeRoots": [], - // "types": [], - // "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - // "allowUmdGlobalAccess": true, - /* Source Map Options */ - //"sourceRoot": "./src", - //"mapRoot": "./dist", - //"inlineSourceMap": false, - //"inlineSources": false, - /* Experimental Options */ - "experimentalDecorators": true, - "emitDecoratorMetadata": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "allowJs": true, - "isolatedModules": true - }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - "src/front/next.config.js" - ], - "exclude": [ - "node_modules" - ] -} \ No newline at end of file + "compilerOptions": { + "incremental": false, + "target": "es5", + "module": "CommonJS", + "lib": ["dom", "dom.iterable", "esnext"], + "jsx": "preserve", + "sourceMap": true, + "outDir": "./dist", + "rootDir": "./", + "noEmit": false, + "importHelpers": true, + "resolveJsonModule": true, + /* Strict Type-Checking Options */ + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "exactOptionalPropertyTypes": false, + "noImplicitOverride": true, + "strict": true, + "noImplicitAny": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "strictBindCallApply": true, + "strictPropertyInitialization": true, + "noImplicitThis": true, + "alwaysStrict": true, + "noPropertyAccessFromIndexSignature": true, + /* Additional Checks */ + "noUnusedLocals": true, + "noImplicitReturns": true, + "noUncheckedIndexedAccess": true, + "useUnknownInCatchVariables": true, + /* Module Resolution Options */ + "moduleResolution": "node", + "baseUrl": ".", + "paths": { + "@Api/*": ["src/api/*"], + "@Front/*": ["src/front/*"], + "@Assets/*": ["src/front/Assets/*"], + "@Components/*": ["src/front/Components/*"], + "@Themes/*": ["src/front/Themes/*"], + "@Stores/*": ["src/front/Stores/*"], + "@FrontServices/*": ["src/front/services/*"], + "@Page/*": ["src/pages/*"] + }, + // "rootDirs": [], + // "typeRoots": [], + // "types": [], + // "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + // "allowUmdGlobalAccess": true, + /* Source Map Options */ + //"sourceRoot": "./src", + //"mapRoot": "./dist", + //"inlineSourceMap": false, + //"inlineSources": false, + /* Experimental Options */ + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "allowJs": true, + "isolatedModules": true + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "src/front/next.config.js"], + "exclude": ["node_modules"] +} From b3489ba4a6a416088594850dc253cca568cfe193 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Thu, 21 Dec 2023 11:44:03 +0100 Subject: [PATCH 2/5] :bug: Fixing dockerfile --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index be27f608..81dec8af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,9 @@ COPY --from=deps leCoffre-front/package.json package.json COPY tsconfig.json tsconfig.json COPY next.config.js next.config.js COPY src src +COPY sentry.client.config.ts sentry.client.config.ts +COPY sentry.edge.config.ts sentry.edge.config.ts +COPY sentry.server.config.ts sentry.server.config.ts RUN npm run build From ee0359b50651b3e8bf8d7ac3f469e9cda62cb402 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Thu, 21 Dec 2023 11:56:36 +0100 Subject: [PATCH 3/5] :bug: Trying to debug --- next.config.js | 58 +++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/next.config.js b/next.config.js index efdfe7bd..01278365 100644 --- a/next.config.js +++ b/next.config.js @@ -1,5 +1,6 @@ /** @type {import('next').NextConfig} */ +console.log(process.env); const nextConfig = { reactStrictMode: false, publicRuntimeConfig: { @@ -56,45 +57,44 @@ const nextConfig = { module.exports = nextConfig; - // Injected content via Sentry wizard below const { withSentryConfig } = require("@sentry/nextjs"); module.exports = withSentryConfig( - module.exports, - { - // For all available options, see: - // https://github.com/getsentry/sentry-webpack-plugin#options + module.exports, + { + // For all available options, see: + // https://github.com/getsentry/sentry-webpack-plugin#options - // Suppresses source map uploading logs during build - silent: true, - org: "smart-chain-nh", - project: "lecoffre", - }, - { - // For all available options, see: - // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ + // Suppresses source map uploading logs during build + silent: true, + org: "smart-chain-nh", + project: "lecoffre", + }, + { + // For all available options, see: + // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ - // Upload a larger set of source maps for prettier stack traces (increases build time) - widenClientFileUpload: true, + // Upload a larger set of source maps for prettier stack traces (increases build time) + widenClientFileUpload: true, - // Transpiles SDK to be compatible with IE11 (increases bundle size) - transpileClientSDK: true, + // Transpiles SDK to be compatible with IE11 (increases bundle size) + transpileClientSDK: true, - // Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load) - tunnelRoute: "/monitoring", + // Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load) + tunnelRoute: "/monitoring", - // Hides source maps from generated client bundles - hideSourceMaps: true, + // Hides source maps from generated client bundles + hideSourceMaps: true, - // Automatically tree-shake Sentry logger statements to reduce bundle size - disableLogger: true, + // Automatically tree-shake Sentry logger statements to reduce bundle size + disableLogger: true, - // Enables automatic instrumentation of Vercel Cron Monitors. - // See the following for more information: - // https://docs.sentry.io/product/crons/ - // https://vercel.com/docs/cron-jobs - automaticVercelMonitors: true, - } + // Enables automatic instrumentation of Vercel Cron Monitors. + // See the following for more information: + // https://docs.sentry.io/product/crons/ + // https://vercel.com/docs/cron-jobs + automaticVercelMonitors: true, + }, ); From f57e2c6a52b3a04632da9812ef1b6ba7faa4d9c7 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Tue, 2 Jan 2024 17:06:41 +0100 Subject: [PATCH 4/5] :sparkles: Sentry working --- next.config.js | 1 - sentry.client.config.ts | 36 +++++++------ sentry.edge.config.ts | 12 +++-- sentry.server.config.ts | 12 +++-- src/pages/api/sentry-example-api.js | 5 -- src/pages/sentry-example-page.jsx | 84 ----------------------------- 6 files changed, 33 insertions(+), 117 deletions(-) delete mode 100644 src/pages/api/sentry-example-api.js delete mode 100644 src/pages/sentry-example-page.jsx diff --git a/next.config.js b/next.config.js index 01278365..3dc7cda8 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,5 @@ /** @type {import('next').NextConfig} */ -console.log(process.env); const nextConfig = { reactStrictMode: false, publicRuntimeConfig: { diff --git a/sentry.client.config.ts b/sentry.client.config.ts index a21b356c..1200514b 100644 --- a/sentry.client.config.ts +++ b/sentry.client.config.ts @@ -4,27 +4,29 @@ import * as Sentry from "@sentry/nextjs"; +console.log("Client config"); + Sentry.init({ - dsn: "https://ca6a89e8b480c814e1b5828b8412c681@o4506382103281664.ingest.sentry.io/4506399972130816", + dsn: "https://ca6a89e8b480c814e1b5828b8412c681@o4506382103281664.ingest.sentry.io/4506399972130816", - // Adjust this value in production, or use tracesSampler for greater control - tracesSampleRate: 1, + // Adjust this value in production, or use tracesSampler for greater control + tracesSampleRate: 1, - // Setting this option to true will print useful information to the console while you're setting up Sentry. - debug: false, + // Setting this option to true will print useful information to the console while you're setting up Sentry. + debug: false, - replaysOnErrorSampleRate: 1.0, + replaysOnErrorSampleRate: 1.0, - // This sets the sample rate to be 10%. You may want this to be 100% while - // in development and sample at a lower rate in production - replaysSessionSampleRate: 0.1, + // This sets the sample rate to be 10%. You may want this to be 100% while + // in development and sample at a lower rate in production + replaysSessionSampleRate: 0.1, - // You can remove this option if you're not planning to use the Sentry Session Replay feature: - integrations: [ - new Sentry.Replay({ - // Additional Replay configuration goes in here, for example: - maskAllText: true, - blockAllMedia: true, - }), - ], + // You can remove this option if you're not planning to use the Sentry Session Replay feature: + integrations: [ + new Sentry.Replay({ + // Additional Replay configuration goes in here, for example: + maskAllText: true, + blockAllMedia: true, + }), + ], }); diff --git a/sentry.edge.config.ts b/sentry.edge.config.ts index 397d9fa5..0d8edd27 100644 --- a/sentry.edge.config.ts +++ b/sentry.edge.config.ts @@ -5,12 +5,14 @@ import * as Sentry from "@sentry/nextjs"; +console.log("Edge config"); + Sentry.init({ - dsn: "https://ca6a89e8b480c814e1b5828b8412c681@o4506382103281664.ingest.sentry.io/4506399972130816", + dsn: "https://ca6a89e8b480c814e1b5828b8412c681@o4506382103281664.ingest.sentry.io/4506399972130816", - // Adjust this value in production, or use tracesSampler for greater control - tracesSampleRate: 1, + // Adjust this value in production, or use tracesSampler for greater control + tracesSampleRate: 1, - // Setting this option to true will print useful information to the console while you're setting up Sentry. - debug: false, + // Setting this option to true will print useful information to the console while you're setting up Sentry. + debug: false, }); diff --git a/sentry.server.config.ts b/sentry.server.config.ts index ca8cca0e..57e9946b 100644 --- a/sentry.server.config.ts +++ b/sentry.server.config.ts @@ -4,12 +4,14 @@ import * as Sentry from "@sentry/nextjs"; +console.log("Server config"); + Sentry.init({ - dsn: "https://ca6a89e8b480c814e1b5828b8412c681@o4506382103281664.ingest.sentry.io/4506399972130816", + dsn: "https://ca6a89e8b480c814e1b5828b8412c681@o4506382103281664.ingest.sentry.io/4506399972130816", - // Adjust this value in production, or use tracesSampler for greater control - tracesSampleRate: 1, + // Adjust this value in production, or use tracesSampler for greater control + tracesSampleRate: 1, - // Setting this option to true will print useful information to the console while you're setting up Sentry. - debug: false, + // Setting this option to true will print useful information to the console while you're setting up Sentry. + debug: false, }); diff --git a/src/pages/api/sentry-example-api.js b/src/pages/api/sentry-example-api.js deleted file mode 100644 index ac07eec0..00000000 --- a/src/pages/api/sentry-example-api.js +++ /dev/null @@ -1,5 +0,0 @@ -// A faulty API route to test Sentry's error monitoring -export default function handler(_req, res) { - throw new Error("Sentry Example API Route Error"); - res.status(200).json({ name: "John Doe" }); -} diff --git a/src/pages/sentry-example-page.jsx b/src/pages/sentry-example-page.jsx deleted file mode 100644 index 37f9530a..00000000 --- a/src/pages/sentry-example-page.jsx +++ /dev/null @@ -1,84 +0,0 @@ -import Head from "next/head"; -import * as Sentry from "@sentry/nextjs"; - -export default function Page() { - return ( -
- - Sentry Onboarding - - - -
-

- - - -

- -

Get started by sending us a sample error:

- - -

- Next, look for the error on the{" "} - Issues Page. -

-

- For more information, see{" "} - - https://docs.sentry.io/platforms/javascript/guides/nextjs/ - -

-
-
- ); -} From b263eb33a4e5c2f9fafd5853a77691d0f2f70274 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Tue, 2 Jan 2024 17:52:52 +0100 Subject: [PATCH 5/5] :sparkles: Setting sentry service tag --- sentry.client.config.ts | 2 ++ sentry.edge.config.ts | 2 ++ sentry.server.config.ts | 2 ++ 3 files changed, 6 insertions(+) diff --git a/sentry.client.config.ts b/sentry.client.config.ts index 1200514b..b9e7b626 100644 --- a/sentry.client.config.ts +++ b/sentry.client.config.ts @@ -30,3 +30,5 @@ Sentry.init({ }), ], }); + +Sentry.setTag("service", "leCoffre-front"); diff --git a/sentry.edge.config.ts b/sentry.edge.config.ts index 0d8edd27..5fbff9a4 100644 --- a/sentry.edge.config.ts +++ b/sentry.edge.config.ts @@ -16,3 +16,5 @@ Sentry.init({ // Setting this option to true will print useful information to the console while you're setting up Sentry. debug: false, }); + +Sentry.setTag("service", "leCoffre-front"); diff --git a/sentry.server.config.ts b/sentry.server.config.ts index 57e9946b..c3eaf2b0 100644 --- a/sentry.server.config.ts +++ b/sentry.server.config.ts @@ -15,3 +15,5 @@ Sentry.init({ // Setting this option to true will print useful information to the console while you're setting up Sentry. debug: false, }); + +Sentry.setTag("service", "leCoffre-front");