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 diff --git a/next.config.js b/next.config.js index efdfe7bd..3dc7cda8 100644 --- a/next.config.js +++ b/next.config.js @@ -56,45 +56,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, + }, ); diff --git a/sentry.client.config.ts b/sentry.client.config.ts index a21b356c..b9e7b626 100644 --- a/sentry.client.config.ts +++ b/sentry.client.config.ts @@ -4,27 +4,31 @@ 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 397d9fa5..5fbff9a4 100644 --- a/sentry.edge.config.ts +++ b/sentry.edge.config.ts @@ -5,12 +5,16 @@ 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 ca8cca0e..c3eaf2b0 100644 --- a/sentry.server.config.ts +++ b/sentry.server.config.ts @@ -4,12 +4,16 @@ 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 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/ - -

-
-
- ); -}