feat: Add Sentry

feat/add-sentry
Keith Williams 2023-10-30 16:33:34 -03:00
parent 31f3d9778e
commit 33bceb04f6
6 changed files with 20 additions and 1 deletions

View File

@ -3,6 +3,7 @@ const CopyWebpackPlugin = require("copy-webpack-plugin");
const os = require("os");
const englishTranslation = require("./public/static/locales/en/common.json");
const { withAxiom } = require("next-axiom");
const { withSentryConfig } = require("@sentry/nextjs");
const { version } = require("./package.json");
const { i18n } = require("./next-i18next.config");
const {
@ -92,6 +93,11 @@ if (process.env.ANALYZE === "true") {
}
plugins.push(withAxiom);
if (!!process.env.NEXT_PUBLIC_SENTRY_DSN) {
plugins.push(withSentryConfig);
}
const matcherConfigRootPath = {
has: [
{
@ -149,6 +155,10 @@ const nextConfig = {
localeDetection: false,
},
productionBrowserSourceMaps: true,
sentry: {
autoInstrumentServerFunctions: true,
hideSourceMaps: true,
},
/* We already do type check on GH actions */
typescript: {
ignoreBuildErrors: !!process.env.CI,

View File

@ -1,4 +1,6 @@
import { wrapApiHandlerWithSentry } from "@sentry/nextjs";
import { createNextApiHandler } from "@calcom/trpc/server/createNextApiHandler";
import { slotsRouter } from "@calcom/trpc/server/routers/viewer/slots/_router";
export default createNextApiHandler(slotsRouter);
export default wrapApiHandlerWithSentry(createNextApiHandler(slotsRouter, "/api/trpc/slots/[trpc]"));

View File

View File

View File

@ -0,0 +1,6 @@
import * as Sentry from "@sentry/nextjs";
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
tracesSampleRate: 0,
});

View File

@ -26,6 +26,7 @@
"outputs": [".next/**"],
"env": [
"NEXT_PUBLIC_IS_E2E",
"NEXT_PUBLIC_SENTRY_DSN",
"NEXT_PUBLIC_STRIPE_PREMIUM_PLAN_PRICE_MONTHLY",
"NEXT_PUBLIC_STRIPE_PREMIUM_PLAN_PRODUCT_ID",
"NEXT_PUBLIC_STRIPE_PUBLIC_KEY",