Skip to content

Commit 4ac8bf9

Browse files
authored
Merge pull request #111 from devakone/develop
Release: develop → main
2 parents 90fdab4 + 82a51df commit 4ac8bf9

7 files changed

Lines changed: 49 additions & 29 deletions

File tree

apps/web/instrumentation-client.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,19 @@ import * as Sentry from "@sentry/nextjs";
77
Sentry.init({
88
dsn: "https://0ddc11d7b3f42d5ca32ecf0b74ff61ef@o4510870266118144.ingest.us.sentry.io/4510870274899968",
99

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

13-
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
14-
tracesSampleRate: 1,
15-
// Enable logs to be sent to Sentry
12+
environment: process.env.NODE_ENV,
13+
14+
tracesSampleRate: process.env.NODE_ENV === "production" ? 0.1 : 1,
15+
1616
enableLogs: true,
1717

18-
// Define how likely Replay events are sampled.
19-
// This sets the sample rate to be 10%. You may want this to be 100% while
20-
// in development and sample at a lower rate in production
2118
replaysSessionSampleRate: 0.1,
2219

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

26-
// Enable sending user PII (Personally Identifiable Information)
27-
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
28-
sendDefaultPii: true,
22+
sendDefaultPii: false,
2923
});
3024

3125
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;

apps/web/next.config.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,13 @@ const nextConfig: NextConfig = {
3636
};
3737

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

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

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

50-
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
5147
tunnelRoute: "/monitoring",
5248
});

apps/web/sentry.edge.config.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ import * as Sentry from "@sentry/nextjs";
88
Sentry.init({
99
dsn: "https://0ddc11d7b3f42d5ca32ecf0b74ff61ef@o4510870266118144.ingest.us.sentry.io/4510870274899968",
1010

11-
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
12-
tracesSampleRate: 1,
11+
environment: process.env.VERCEL_ENV ?? process.env.NODE_ENV,
12+
13+
tracesSampleRate: process.env.NODE_ENV === "production" ? 0.1 : 1,
1314

14-
// Enable logs to be sent to Sentry
1515
enableLogs: true,
1616

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

apps/web/sentry.server.config.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ import * as Sentry from "@sentry/nextjs";
77
Sentry.init({
88
dsn: "https://0ddc11d7b3f42d5ca32ecf0b74ff61ef@o4510870266118144.ingest.us.sentry.io/4510870274899968",
99

10-
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
11-
tracesSampleRate: 1,
10+
environment: process.env.VERCEL_ENV ?? process.env.NODE_ENV,
11+
12+
tracesSampleRate: process.env.NODE_ENV === "production" ? 0.1 : 1,
1213

13-
// Enable logs to be sent to Sentry
1414
enableLogs: true,
1515

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

apps/web/src/app/global-error.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"use client";
2+
3+
import * as Sentry from "@sentry/nextjs";
4+
import NextError from "next/error";
5+
import { useEffect } from "react";
6+
7+
export default function GlobalError({
8+
error,
9+
}: {
10+
error: Error & { digest?: string };
11+
}) {
12+
useEffect(() => {
13+
Sentry.captureException(error);
14+
}, [error]);
15+
16+
return (
17+
<html>
18+
<body>
19+
<NextError statusCode={0} />
20+
</body>
21+
</html>
22+
);
23+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { describe, expect, it } from "vitest";
2+
3+
import { config } from "@/proxy";
4+
5+
describe("Sentry routing", () => {
6+
it("excludes the Sentry tunnel from the auth proxy", () => {
7+
expect(config.matcher).toEqual([
8+
"/((?!monitoring|_next/static|_next/image|favicon.ico).*)",
9+
]);
10+
});
11+
});

apps/web/src/proxy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@ export async function proxy(request: NextRequest) {
7474
}
7575

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

0 commit comments

Comments
 (0)