From 3bad2cdac5d8ac5937ea1fb217a8c44197dadcf2 Mon Sep 17 00:00:00 2001 From: Angelo Reale <12191809+angeloreale@users.noreply.github.com> Date: Mon, 26 Aug 2024 03:33:02 +0100 Subject: [PATCH] [Snyk] Upgrade @sentry/nextjs from 8.20.0 to 8.22.0 (#32) * fix: upgrade @sentry/nextjs from 8.20.0 to 8.22.0 Snyk has created this PR to upgrade @sentry/nextjs from 8.20.0 to 8.22.0. See this package in npm: @sentry/nextjs See this project in Snyk: https://app.snyk.io/org/angeloreale/project/0ce13fdb-820a-4a03-9e39-a46edd73375a?utm_source=github&utm_medium=referral&page=upgrade-pr * ar(config) sentry --------- Co-authored-by: snyk-bot --- .gitignore | 4 +- next.config.mjs | 68 ++++++------ package-lock.json | 218 +++++++++++++++++++++++---------------- package.json | 2 +- sentry.client.config.ts | 29 ++++++ sentry.edge.config.ts | 16 +++ sentry.server.config.ts | 18 ++++ src/app/global-error.tsx | 23 +++++ src/instrumentation.ts | 9 ++ 9 files changed, 257 insertions(+), 130 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/app/global-error.tsx create mode 100644 src/instrumentation.ts diff --git a/.gitignore b/.gitignore index b2b9c57..14bf5bf 100644 --- a/.gitignore +++ b/.gitignore @@ -42,4 +42,6 @@ next-env.d.ts # private *.private -stub.json \ No newline at end of file +stub.json +# Sentry Config File +.env.sentry-build-plugin diff --git a/next.config.mjs b/next.config.mjs index dfeb203..efba8b6 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,3 +1,4 @@ +import { withSentryConfig } from '@sentry/nextjs'; import { PrismaPlugin } from '@prisma/nextjs-monorepo-workaround-plugin'; // const headers = [ @@ -65,49 +66,42 @@ const nextConfig = { }, }; -export default nextConfig; +export default withSentryConfig(nextConfig, { + // For all available options, see: + // https://github.com/getsentry/sentry-webpack-plugin#options -// Injected content via Sentry wizard below + org: 'dreampip', + project: 'hypnos', -// const { withSentryConfig } = require('@sentry/nextjs'); + // Only print logs for uploading source maps in CI + silent: !process.env.CI, -// module.exports = withSentryConfig( -// module.exports, -// { -// // For all available options, see: -// // https://github.com/getsentry/sentry-webpack-plugin#options + // 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: 'dreampip', -// project: 'hypnos', -// }, -// { -// // 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, + // Automatically annotate React components to show their full name in breadcrumbs and session replay + reactComponentAnnotation: { + enabled: true, + }, -// // Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers. -// // This can increase your server load as well as your hosting bill. -// // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client- -// // side errors will fail. -// // tunnelRoute: "/monitoring", + // Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers. + // This can increase your server load as well as your hosting bill. + // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client- + // side errors will fail. + // 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. (Does not yet work with App Router route handlers.) + // 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 56c4958..a031ff0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "hasInstallScript": true, "license": "HPL3-ECO-AND-ANC", "dependencies": { - "@sentry/nextjs": "^8.20.0", + "@sentry/nextjs": "^8.22.0", "next": "14.2.4" }, "devDependencies": { @@ -963,6 +963,15 @@ "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, + "node_modules/@opentelemetry/core/node_modules/@opentelemetry/semantic-conventions": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.25.1.tgz", + "integrity": "sha512-ZDjMJJQRlyk8A1KZFCc+bCbsyrn1wTwdNt56F7twdfUfnHUZUq77/WfONCj8p72NZOyP7pNTdUWSTYC3GTbuuQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, "node_modules/@opentelemetry/instrumentation": { "version": "0.52.1", "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.52.1.tgz", @@ -1002,9 +1011,9 @@ } }, "node_modules/@opentelemetry/instrumentation-express": { - "version": "0.41.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-express/-/instrumentation-express-0.41.0.tgz", - "integrity": "sha512-/B7fbMdaf3SYe5f1P973tkqd6s7XZirjpfkoJ63E7nltU30qmlgm9tY5XwZOzAFI0rHS9tbrFI2HFPAvQUFe/A==", + "version": "0.41.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-express/-/instrumentation-express-0.41.1.tgz", + "integrity": "sha512-uRx0V3LPGzjn2bxAnV8eUsDT82vT7NTwI0ezEuPMBOTOsnPpGhWdhcdNdhH80sM4TrWrOfXm9HGEdfWE3TRIww==", "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.8.0", @@ -1085,6 +1094,15 @@ "@opentelemetry/api": "^1.3.0" } }, + "node_modules/@opentelemetry/instrumentation-http/node_modules/@opentelemetry/semantic-conventions": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.25.1.tgz", + "integrity": "sha512-ZDjMJJQRlyk8A1KZFCc+bCbsyrn1wTwdNt56F7twdfUfnHUZUq77/WfONCj8p72NZOyP7pNTdUWSTYC3GTbuuQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, "node_modules/@opentelemetry/instrumentation-http/node_modules/semver": { "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", @@ -1288,6 +1306,15 @@ "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, + "node_modules/@opentelemetry/resources/node_modules/@opentelemetry/semantic-conventions": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.25.1.tgz", + "integrity": "sha512-ZDjMJJQRlyk8A1KZFCc+bCbsyrn1wTwdNt56F7twdfUfnHUZUq77/WfONCj8p72NZOyP7pNTdUWSTYC3GTbuuQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, "node_modules/@opentelemetry/sdk-metrics": { "version": "1.25.1", "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.25.1.tgz", @@ -1322,7 +1349,7 @@ "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, - "node_modules/@opentelemetry/semantic-conventions": { + "node_modules/@opentelemetry/sdk-trace-base/node_modules/@opentelemetry/semantic-conventions": { "version": "1.25.1", "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.25.1.tgz", "integrity": "sha512-ZDjMJJQRlyk8A1KZFCc+bCbsyrn1wTwdNt56F7twdfUfnHUZUq77/WfONCj8p72NZOyP7pNTdUWSTYC3GTbuuQ==", @@ -1331,6 +1358,15 @@ "node": ">=14" } }, + "node_modules/@opentelemetry/semantic-conventions": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.26.0.tgz", + "integrity": "sha512-U9PJlOswJPSgQVPI+XEuNLElyFWkb0hAiMg+DExD9V0St03X2lPHGMdxMY/LrVmoukuIpXJ12oyrOtEZ4uXFkw==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, "node_modules/@opentelemetry/sql-common": { "version": "0.40.1", "resolved": "https://registry.npmjs.org/@opentelemetry/sql-common/-/sql-common-0.40.1.tgz", @@ -1807,58 +1843,58 @@ "license": "MIT" }, "node_modules/@sentry-internal/browser-utils": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.20.0.tgz", - "integrity": "sha512-GGYNiELnT4ByidHyS4/M8UF8Oxagm5R13QyTncQGq8nZcQhcFZ9mdxLnf1/R4+j44Fph2Cgzafe8jGP/AMA9zw==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.22.0.tgz", + "integrity": "sha512-R0u8KPaSivueIwUOhmYxcisKaJq3gx+I0xOcWoluDB3OI1Ds/QOSP/vmTsMg/mjwG/nUJ8RRM8pj0s8vlqCrjg==", "license": "MIT", "dependencies": { - "@sentry/core": "8.20.0", - "@sentry/types": "8.20.0", - "@sentry/utils": "8.20.0" + "@sentry/core": "8.22.0", + "@sentry/types": "8.22.0", + "@sentry/utils": "8.22.0" }, "engines": { "node": ">=14.18" } }, "node_modules/@sentry-internal/feedback": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.20.0.tgz", - "integrity": "sha512-mFvAoVpVShkDB2AgEr/dE96NSTPKI/lGMBznZMg7ZEcwZhLfH7HvLYCadIskRfzqFTLOUpbm9ciIO4SyR/4bDA==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.22.0.tgz", + "integrity": "sha512-Sy2+v0xBmVnZ5LQ48603CvLy5vVQvAZ+hc9xQSAHexts07NkvApMU1qv26YNwxlAWfDha1wXiW6ryd4YDzaoVA==", "license": "MIT", "dependencies": { - "@sentry/core": "8.20.0", - "@sentry/types": "8.20.0", - "@sentry/utils": "8.20.0" + "@sentry/core": "8.22.0", + "@sentry/types": "8.22.0", + "@sentry/utils": "8.22.0" }, "engines": { "node": ">=14.18" } }, "node_modules/@sentry-internal/replay": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.20.0.tgz", - "integrity": "sha512-sCiI7SOAHq5XsxkixtoMofeSyKd/hVgDV+4145f6nN9m7nLzig4PBQwh2SgK2piJ2mfaXfqcdzA1pShPYldaJA==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.22.0.tgz", + "integrity": "sha512-sF8RyMPJP1fSIyyBDAbtybvKCu0dy8ZAfMwLP7ZqEnWrhZqktVuqM7/++EAFMlD5YaWJXm1IDuOXjgSQjUtSIQ==", "license": "MIT", "dependencies": { - "@sentry-internal/browser-utils": "8.20.0", - "@sentry/core": "8.20.0", - "@sentry/types": "8.20.0", - "@sentry/utils": "8.20.0" + "@sentry-internal/browser-utils": "8.22.0", + "@sentry/core": "8.22.0", + "@sentry/types": "8.22.0", + "@sentry/utils": "8.22.0" }, "engines": { "node": ">=14.18" } }, "node_modules/@sentry-internal/replay-canvas": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.20.0.tgz", - "integrity": "sha512-LXV/pMH9KMw6CtImenMsiBkYIFIc97pDJ/rC7mVImKIROQ45fxGp/JBXM4Id0GENyA2+SySMWVQCAAapSfHZTw==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.22.0.tgz", + "integrity": "sha512-/gV8qN3JqWw0LXTMuCGB8RDI8Bx1VESNRBdh/7Cmc5+hxYBfcketuix3S8mHWcE/JO+Ed9g1Abzys6GphTB9LA==", "license": "MIT", "dependencies": { - "@sentry-internal/replay": "8.20.0", - "@sentry/core": "8.20.0", - "@sentry/types": "8.20.0", - "@sentry/utils": "8.20.0" + "@sentry-internal/replay": "8.22.0", + "@sentry/core": "8.22.0", + "@sentry/types": "8.22.0", + "@sentry/utils": "8.22.0" }, "engines": { "node": ">=14.18" @@ -1873,18 +1909,18 @@ } }, "node_modules/@sentry/browser": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.20.0.tgz", - "integrity": "sha512-JDZbCreY44/fHYN28QzsAwEHXa2rc1hzM6GE4RSlXCdAhNfrjVxyYDxhw/50pVEHZg1WXxf7ZmERjocV5VJHsw==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.22.0.tgz", + "integrity": "sha512-t3b+/9WWcP9SQTWwrHrB57B33ENgmUjyFlW2+JSlCXkSJBSmAoquPZ/GPjOuPaSr3HIA0mu9uEr4A41d5diASQ==", "license": "MIT", "dependencies": { - "@sentry-internal/browser-utils": "8.20.0", - "@sentry-internal/feedback": "8.20.0", - "@sentry-internal/replay": "8.20.0", - "@sentry-internal/replay-canvas": "8.20.0", - "@sentry/core": "8.20.0", - "@sentry/types": "8.20.0", - "@sentry/utils": "8.20.0" + "@sentry-internal/browser-utils": "8.22.0", + "@sentry-internal/feedback": "8.22.0", + "@sentry-internal/replay": "8.22.0", + "@sentry-internal/replay-canvas": "8.22.0", + "@sentry/core": "8.22.0", + "@sentry/types": "8.22.0", + "@sentry/utils": "8.22.0" }, "engines": { "node": ">=14.18" @@ -2095,34 +2131,34 @@ } }, "node_modules/@sentry/core": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.20.0.tgz", - "integrity": "sha512-R81snuw+67VT4aCxr6ShST/s0Y6FlwN2YczhDwaGyzumn5rlvA6A4JtQDeExduNoDDyv4T3LrmW8wlYZn3CJJw==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.22.0.tgz", + "integrity": "sha512-fYPnxp7UkY2tckaOtivIySxnJvlbekuxs+Qi6rkUv9JpF+TYKpt7OPNUAbgVIhS0xazAEN6iKTfmnmpUbFRLmQ==", "license": "MIT", "dependencies": { - "@sentry/types": "8.20.0", - "@sentry/utils": "8.20.0" + "@sentry/types": "8.22.0", + "@sentry/utils": "8.22.0" }, "engines": { "node": ">=14.18" } }, "node_modules/@sentry/nextjs": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@sentry/nextjs/-/nextjs-8.20.0.tgz", - "integrity": "sha512-ZMi50qeklxibnNehlghNvlmzz1NIvYUGglDMy/m/N67SfXiq5PXyVziJAoCKQXR7nrvoQx0Mx17Z9ZFIwgjSJQ==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@sentry/nextjs/-/nextjs-8.22.0.tgz", + "integrity": "sha512-XYb/3ocQLhZmdqqTgI7xce7AiRpHn3L6Sj3RVTBwNb4nb+XOfQ8o0LKF7v7yo6LGoQin+IWpWPACnNc8zH7fBA==", "license": "MIT", "dependencies": { "@opentelemetry/instrumentation-http": "0.52.1", "@opentelemetry/semantic-conventions": "^1.25.1", "@rollup/plugin-commonjs": "26.0.1", - "@sentry/core": "8.20.0", - "@sentry/node": "8.20.0", - "@sentry/opentelemetry": "8.20.0", - "@sentry/react": "8.20.0", - "@sentry/types": "8.20.0", - "@sentry/utils": "8.20.0", - "@sentry/vercel-edge": "8.20.0", + "@sentry/core": "8.22.0", + "@sentry/node": "8.22.0", + "@sentry/opentelemetry": "8.22.0", + "@sentry/react": "8.22.0", + "@sentry/types": "8.22.0", + "@sentry/utils": "8.22.0", + "@sentry/vercel-edge": "8.22.0", "@sentry/webpack-plugin": "2.20.1", "chalk": "3.0.0", "resolve": "1.22.8", @@ -2198,9 +2234,9 @@ } }, "node_modules/@sentry/node": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@sentry/node/-/node-8.20.0.tgz", - "integrity": "sha512-i4ywT2m0Gw65U3uwI4NwiNcyqp9YF6/RsusfH1pg4YkiL/RYp7FS0MPVgMggfvoue9S3KjCgRVlzTLwFATyPXQ==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-8.22.0.tgz", + "integrity": "sha512-xDLB4TJXT8iFKwoFneOIJtlfpsUB6L0m32Do97TrQ1dY2WilspksznrU2Ac+XfshdNxa8Sqr4tSj07Yzn0VNiQ==", "license": "MIT", "dependencies": { "@opentelemetry/api": "^1.9.0", @@ -2208,7 +2244,7 @@ "@opentelemetry/core": "^1.25.1", "@opentelemetry/instrumentation": "^0.52.1", "@opentelemetry/instrumentation-connect": "0.38.0", - "@opentelemetry/instrumentation-express": "0.41.0", + "@opentelemetry/instrumentation-express": "0.41.1", "@opentelemetry/instrumentation-fastify": "0.38.0", "@opentelemetry/instrumentation-graphql": "0.42.0", "@opentelemetry/instrumentation-hapi": "0.40.0", @@ -2226,11 +2262,11 @@ "@opentelemetry/sdk-trace-base": "^1.25.1", "@opentelemetry/semantic-conventions": "^1.25.1", "@prisma/instrumentation": "5.17.0", - "@sentry/core": "8.20.0", - "@sentry/opentelemetry": "8.20.0", - "@sentry/types": "8.20.0", - "@sentry/utils": "8.20.0", - "import-in-the-middle": "^1.10.0" + "@sentry/core": "8.22.0", + "@sentry/opentelemetry": "8.22.0", + "@sentry/types": "8.22.0", + "@sentry/utils": "8.22.0", + "import-in-the-middle": "^1.11.0" }, "engines": { "node": ">=14.18" @@ -2240,14 +2276,14 @@ } }, "node_modules/@sentry/opentelemetry": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@sentry/opentelemetry/-/opentelemetry-8.20.0.tgz", - "integrity": "sha512-NFcLK6+t9wUc4HlGKeuDn6W4KjZxZfZmWlrK2/tgC5KzG1cnVeOnWUrJzGHTa+YDDdIijpjiFUcpXGPkX3rmIg==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@sentry/opentelemetry/-/opentelemetry-8.22.0.tgz", + "integrity": "sha512-JqNsoyPdZ88Me2SdxAqq/5agcMzUzZ5xIjrM4ETC1aaeD+cPij/xL4U31b8S7aFJy3miaaZqFzpBy9A/YtFxLw==", "license": "MIT", "dependencies": { - "@sentry/core": "8.20.0", - "@sentry/types": "8.20.0", - "@sentry/utils": "8.20.0" + "@sentry/core": "8.22.0", + "@sentry/types": "8.22.0", + "@sentry/utils": "8.22.0" }, "engines": { "node": ">=14.18" @@ -2261,15 +2297,15 @@ } }, "node_modules/@sentry/react": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@sentry/react/-/react-8.20.0.tgz", - "integrity": "sha512-vqA0o9ysdfA24/ADhsJwsmCNdUWRu2ycmVN1Sr76v+ZggyOCFzE7XD13kbqk1G3jPb8nptNu/6Zwpcy5pP4mtw==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@sentry/react/-/react-8.22.0.tgz", + "integrity": "sha512-LcO8SPfjYsx3Zvg1mQwjreVvtriVxde+6njIJyXU9TArB0e8bFexvd4MGXdBExgW9aY449hNaStgKRWMNHeVHQ==", "license": "MIT", "dependencies": { - "@sentry/browser": "8.20.0", - "@sentry/core": "8.20.0", - "@sentry/types": "8.20.0", - "@sentry/utils": "8.20.0", + "@sentry/browser": "8.22.0", + "@sentry/core": "8.22.0", + "@sentry/types": "8.22.0", + "@sentry/utils": "8.22.0", "hoist-non-react-statics": "^3.3.2" }, "engines": { @@ -2280,35 +2316,35 @@ } }, "node_modules/@sentry/types": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.20.0.tgz", - "integrity": "sha512-6IP278KojOpiAA7vrd1hjhUyn26cl0n0nGsShzic5ztCVs92sTeVRnh7MTB9irDVtAbOEyt/YH6go3h+Jia1pA==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.22.0.tgz", + "integrity": "sha512-1MLK3xO+uF2oJaa+M98aLIrQsEHzV7xnVWPfE3MhejYLNQebj4rQnQKTut/xZNIF9W0Q+bRcakLarC3ce2a74g==", "license": "MIT", "engines": { "node": ">=14.18" } }, "node_modules/@sentry/utils": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-8.20.0.tgz", - "integrity": "sha512-+1I5H8dojURiEUGPliDwheQk8dhjp8uV1sMccR/W/zjFrt4wZyPs+Ttp/V7gzm9LDJoNek9tmELert/jQqWTgg==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-8.22.0.tgz", + "integrity": "sha512-0ITG2+3EtyMtyc/nQG8aB9z9eIQ4L43nM/KuNgYSnM1vPl/zegbaLT0Ek/xkQB1OLIOLkEPQ6x9GWe+248/n3g==", "license": "MIT", "dependencies": { - "@sentry/types": "8.20.0" + "@sentry/types": "8.22.0" }, "engines": { "node": ">=14.18" } }, "node_modules/@sentry/vercel-edge": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@sentry/vercel-edge/-/vercel-edge-8.20.0.tgz", - "integrity": "sha512-4UiK72M9mf3++YapeIdwUcF0d1uzWfgYm8fx3YgEz6bQUdrts3Jg4e+dbvpv57uUAiTnNN3JKZmkT1ep9ZonKw==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@sentry/vercel-edge/-/vercel-edge-8.22.0.tgz", + "integrity": "sha512-2kkyJ+mvAOEIcM+YY21kMCjx2OI1r+4qYaKPwXWagns41+BcqAl1I8/lU6ZjbNP2wm9iy4kmYcZwx8P5VLtWAw==", "license": "MIT", "dependencies": { - "@sentry/core": "8.20.0", - "@sentry/types": "8.20.0", - "@sentry/utils": "8.20.0" + "@sentry/core": "8.22.0", + "@sentry/types": "8.22.0", + "@sentry/utils": "8.22.0" }, "engines": { "node": ">=14.18" diff --git a/package.json b/package.json index dce6405..dfbaa6b 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "seed": "node --loader ts-node/esm prisma/seed.mts" }, "dependencies": { - "@sentry/nextjs": "8.20.0", + "@sentry/nextjs": "8.22.0", "next": "14.2.4" }, "devDependencies": { diff --git a/sentry.client.config.ts b/sentry.client.config.ts new file mode 100644 index 0000000..17b0793 --- /dev/null +++ b/sentry.client.config.ts @@ -0,0 +1,29 @@ +// 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://1ffe607dfb2fb221b8239d51270bae61@o4507585573814272.ingest.us.sentry.io/4507841280606208', + + // 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: [ + Sentry.replayIntegration({ + // 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 0000000..ea76e8b --- /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://1ffe607dfb2fb221b8239d51270bae61@o4507585573814272.ingest.us.sentry.io/4507841280606208', + + // 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 0000000..f11c236 --- /dev/null +++ b/sentry.server.config.ts @@ -0,0 +1,18 @@ +// 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://1ffe607dfb2fb221b8239d51270bae61@o4507585573814272.ingest.us.sentry.io/4507841280606208', + + // 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, + + // Uncomment the line below to enable Spotlight (https://spotlightjs.com) + // spotlight: process.env.NODE_ENV === 'development', +}); diff --git a/src/app/global-error.tsx b/src/app/global-error.tsx new file mode 100644 index 0000000..20c1750 --- /dev/null +++ b/src/app/global-error.tsx @@ -0,0 +1,23 @@ +'use client'; + +import * as Sentry from '@sentry/nextjs'; +import NextError from 'next/error'; +import { useEffect } from 'react'; + +export default function GlobalError({ error }: { error: Error & { digest?: string } }) { + useEffect(() => { + Sentry.captureException(error); + }, [error]); + + return ( + + + {/* `NextError` is the default Next.js error page component. Its type + definition requires a `statusCode` prop. However, since the App Router + does not expose status codes for errors, we simply pass 0 to render a + generic error message. */} + + + + ); +} diff --git a/src/instrumentation.ts b/src/instrumentation.ts new file mode 100644 index 0000000..6a02852 --- /dev/null +++ b/src/instrumentation.ts @@ -0,0 +1,9 @@ +export async function register() { + if (process.env.NEXT_RUNTIME === 'nodejs') { + await import('../sentry.server.config'); + } + + if (process.env.NEXT_RUNTIME === 'edge') { + await import('../sentry.edge.config'); + } +}