From 43e83f4d35351db35969cf0d0d720e4d8e89fbd3 Mon Sep 17 00:00:00 2001 From: Vins Date: Mon, 12 Feb 2024 14:44:59 +0100 Subject: [PATCH] Revert "Merge branch 'staging' into dev" This reverts commit 8391aba306cfbad605ef83d8278fcfdb8a345a87, reversing changes made to 7daac4ab3a779451831f7895bdfa57806e1f1e36. --- Dockerfile | 3 -- next.config.js | 57 ++++++++++---------- sentry.client.config.ts | 38 ++++++------- sentry.edge.config.ts | 14 ++--- sentry.server.config.ts | 14 ++--- src/pages/api/sentry-example-api.js | 5 ++ src/pages/sentry-example-page.jsx | 84 +++++++++++++++++++++++++++++ 7 files changed, 145 insertions(+), 70 deletions(-) create mode 100644 src/pages/api/sentry-example-api.js create mode 100644 src/pages/sentry-example-page.jsx diff --git a/Dockerfile b/Dockerfile index 81dec8af..be27f608 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,9 +24,6 @@ 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 diff --git a/next.config.js b/next.config.js index 3dc7cda8..efdfe7bd 100644 --- a/next.config.js +++ b/next.config.js @@ -56,44 +56,45 @@ 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, + } ); diff --git a/sentry.client.config.ts b/sentry.client.config.ts index b9e7b626..a21b356c 100644 --- a/sentry.client.config.ts +++ b/sentry.client.config.ts @@ -4,31 +4,27 @@ 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, + }), + ], }); - -Sentry.setTag("service", "leCoffre-front"); diff --git a/sentry.edge.config.ts b/sentry.edge.config.ts index 5fbff9a4..397d9fa5 100644 --- a/sentry.edge.config.ts +++ b/sentry.edge.config.ts @@ -5,16 +5,12 @@ 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, }); - -Sentry.setTag("service", "leCoffre-front"); diff --git a/sentry.server.config.ts b/sentry.server.config.ts index c3eaf2b0..ca8cca0e 100644 --- a/sentry.server.config.ts +++ b/sentry.server.config.ts @@ -4,16 +4,12 @@ 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, }); - -Sentry.setTag("service", "leCoffre-front"); 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/ + +

+
+
+ ); +}