Skip to content

Commit 8626fb4

Browse files
Ajit Pratap Singhclaude
authored andcommitted
feat(website): add Sentry error boundary and withSentryConfig build wrapper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e3fa6f0 commit 8626fb4

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

website/next.config.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import type { NextConfig } from 'next';
22
import withBundleAnalyzer from '@next/bundle-analyzer';
3+
import { withSentryConfig } from '@sentry/nextjs';
34

45
const withAnalyzer = withBundleAnalyzer({
56
enabled: process.env.ANALYZE === 'true',
67
});
78

89
const nextConfig: NextConfig = {
10+
trailingSlash: true,
911
async headers() {
1012
return [
1113
{
@@ -65,4 +67,15 @@ const nextConfig: NextConfig = {
6567
},
6668
};
6769

68-
export default withAnalyzer(nextConfig);
70+
export default withSentryConfig(
71+
withAnalyzer(nextConfig),
72+
{
73+
org: process.env.SENTRY_ORG,
74+
project: process.env.SENTRY_PROJECT,
75+
authToken: process.env.SENTRY_AUTH_TOKEN,
76+
widenClientFileUpload: true,
77+
tunnelRoute: '/monitoring',
78+
silent: !process.env.CI,
79+
// Tree-shaking disabled — using Turbopack which doesn't support webpack tree-shaking
80+
}
81+
);

website/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+
}

0 commit comments

Comments
 (0)