From b3489ba4a6a416088594850dc253cca568cfe193 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Thu, 21 Dec 2023 11:44:03 +0100 Subject: [PATCH 1/4] :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 2/4] :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 3/4] :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 4/4] :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");