Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions apps/web/instrumentation-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,19 @@ import * as Sentry from "@sentry/nextjs";
Sentry.init({
dsn: "https://0ddc11d7b3f42d5ca32ecf0b74ff61ef@o4510870266118144.ingest.us.sentry.io/4510870274899968",

// Add optional integrations for additional features
integrations: [Sentry.replayIntegration()],

// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
tracesSampleRate: 1,
// Enable logs to be sent to Sentry
environment: process.env.NODE_ENV,

tracesSampleRate: process.env.NODE_ENV === "production" ? 0.1 : 1,

enableLogs: true,

// Define how likely Replay events are sampled.
// 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,

// Define how likely Replay events are sampled when an error occurs.
replaysOnErrorSampleRate: 1.0,

// Enable sending user PII (Personally Identifiable Information)
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
sendDefaultPii: true,
sendDefaultPii: false,
});

export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;
6 changes: 1 addition & 5 deletions apps/web/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,13 @@ const nextConfig: NextConfig = {
};

export default withSentryConfig(nextConfig, {
// For all available options, see:
// https://www.npmjs.com/package/@sentry/webpack-plugin#options
org: "100kode",
project: "vibe-coding-profiler",
authToken: process.env.SENTRY_AUTH_TOKEN,

// Only print logs for uploading source maps in CI
silent: !process.env.CI,

// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,

// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
tunnelRoute: "/monitoring",
});
10 changes: 4 additions & 6 deletions apps/web/sentry.edge.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import * as Sentry from "@sentry/nextjs";
Sentry.init({
dsn: "https://0ddc11d7b3f42d5ca32ecf0b74ff61ef@o4510870266118144.ingest.us.sentry.io/4510870274899968",

// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
tracesSampleRate: 1,
environment: process.env.VERCEL_ENV ?? process.env.NODE_ENV,

tracesSampleRate: process.env.NODE_ENV === "production" ? 0.1 : 1,

// Enable logs to be sent to Sentry
enableLogs: true,

// Enable sending user PII (Personally Identifiable Information)
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
sendDefaultPii: true,
sendDefaultPii: false,
});
10 changes: 4 additions & 6 deletions apps/web/sentry.server.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ import * as Sentry from "@sentry/nextjs";
Sentry.init({
dsn: "https://0ddc11d7b3f42d5ca32ecf0b74ff61ef@o4510870266118144.ingest.us.sentry.io/4510870274899968",

// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
tracesSampleRate: 1,
environment: process.env.VERCEL_ENV ?? process.env.NODE_ENV,

tracesSampleRate: process.env.NODE_ENV === "production" ? 0.1 : 1,

// Enable logs to be sent to Sentry
enableLogs: true,

// Enable sending user PII (Personally Identifiable Information)
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
sendDefaultPii: true,
sendDefaultPii: false,
});
23 changes: 23 additions & 0 deletions apps/web/src/app/global-error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"use client";

import * as Sentry from "@sentry/nextjs";
import NextError from "next/error";
import { useEffect } from "react";

export default function GlobalError({
error,
}: {
error: Error & { digest?: string };
}) {
useEffect(() => {
Sentry.captureException(error);
}, [error]);

return (
<html>
<body>
<NextError statusCode={0} />
</body>
</html>
);
}
11 changes: 11 additions & 0 deletions apps/web/src/lib/__tests__/sentry-config.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { describe, expect, it } from "vitest";

import { config } from "@/proxy";

describe("Sentry routing", () => {
it("excludes the Sentry tunnel from the auth proxy", () => {
expect(config.matcher).toEqual([
"/((?!monitoring|_next/static|_next/image|favicon.ico).*)",
]);
});
});
2 changes: 1 addition & 1 deletion apps/web/src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ export async function proxy(request: NextRequest) {
}

export const config = {
matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"],
matcher: ["/((?!monitoring|_next/static|_next/image|favicon.ico).*)"],
};
Loading