Skip to content

Scheduling infrastructure for absolutely everyone.

chore: Wire up Sentry for API (#12756)

Keith Williams2352bb107543
diff --git a/apps/api/next.config.js b/apps/api/next.config.js
index ba2dcbf89b6..4d861ce3c30 100644
--- a/apps/api/next.config.js
+++ b/apps/api/next.config.js
@@ -1,6 +1,8 @@
const { withAxiom } = require("next-axiom");
+const { withSentryConfig } = require("@sentry/nextjs");
-module.exports = withAxiom({
+const plugins = [withAxiom];
+const nextConfig = {
transpilePackages: [
"@calcom/app-store",
"@calcom/core",
@@ -66,4 +68,15 @@ module.exports = withAxiom({
],
};
},
-});
+};
+
+if (!!process.env.NEXT_PUBLIC_SENTRY_DSN) {
+ nextConfig["sentry"] = {
+ autoInstrumentServerFunctions: true,
+ hideSourceMaps: true,
+ };
+
+ plugins.push(withSentryConfig);
+}
+
+module.exports = () => plugins.reduce((acc, next) => next(acc), nextConfig);
diff --git a/apps/api/sentry.client.config.ts b/apps/api/sentry.client.config.ts
new file mode 100644
index 00000000000..cb0ff5c3b54
--- /dev/null
+++ b/apps/api/sentry.client.config.ts
@@ -0,0 +1 @@
+export {};
diff --git a/apps/api/sentry.edge.config.ts b/apps/api/sentry.edge.config.ts
new file mode 100644
index 00000000000..842f09fccc2
--- /dev/null
+++ b/apps/api/sentry.edge.config.ts
@@ -0,0 +1,5 @@
+import * as Sentry from "@sentry/nextjs";
+
+Sentry.init({
+ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
+});
diff --git a/apps/api/sentry.server.config.ts b/apps/api/sentry.server.config.ts
new file mode 100644
index 00000000000..a429088bd9b
--- /dev/null
+++ b/apps/api/sentry.server.config.ts
@@ -0,0 +1,6 @@
+import * as Sentry from "@sentry/nextjs";
+
+Sentry.init({
+ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
+ tracesSampleRate: 1.0,
+});