Skip to content

Commit 49b4a8b

Browse files
authored
Merge pull request #385 from ixartz/update-sentry
Update to Sentry version 9
2 parents 00ead7b + e626bab commit 49b4a8b

File tree

9 files changed

+4028
-4818
lines changed

9 files changed

+4028
-4818
lines changed

.env

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
# Clerk authentication
77
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_cmVsYXhlZC10dXJrZXktNjcuY2xlcmsuYWNjb3VudHMuZGV2JA
88

9-
# Sentry
10-
# Disable Sentry warning with TurboPack
11-
SENTRY_SUPPRESS_TURBOPACK_WARNING=1
12-
139
# PostHog
1410
NEXT_PUBLIC_POSTHOG_KEY=
1511
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
1612

13+
# Next.js
14+
NEXT_TELEMETRY_DISABLED=1
15+
1716
######## [BEGIN] SENSITIVE DATA ######## For security reason, don't update the following variables (secret key) directly in this file.
1817
######## Please create a new file named `.env.local`, all environment files ending with `.local` won't be tracked by Git.
1918
######## After creating the file, you can add the following variables.

.vscode/launch.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,20 @@
66
"configurations": [
77
{
88
"name": "Next.js: debug full stack",
9-
"type": "node-terminal",
9+
"type": "node",
1010
"request": "launch",
11-
"command": "npm run dev",
11+
"program": "${workspaceFolder}/node_modules/next/dist/bin/next",
12+
"runtimeArgs": ["--inspect"],
13+
"skipFiles": ["<node_internals>/**"],
14+
"env": {
15+
"NEXT_PUBLIC_SENTRY_DISABLED": "true"
16+
},
1217
"serverReadyAction": {
18+
"action": "debugWithChrome",
19+
"killOnServerStop": true,
1320
"pattern": "- Local:.+(https?://.+)",
1421
"uriFormat": "%s",
15-
"action": "debugWithChrome"
22+
"webRoot": "${workspaceFolder}"
1623
}
1724
}
1825
]

next.config.ts

Lines changed: 41 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import createNextIntlPlugin from 'next-intl/plugin';
55
import './src/libs/Env';
66

77
// Define the base Next.js configuration
8-
let nextConfig: NextConfig = {
8+
const baseConfig: NextConfig = {
99
eslint: {
1010
dirs: ['.'],
1111
},
@@ -15,55 +15,49 @@ let nextConfig: NextConfig = {
1515
};
1616

1717
// Initialize the Next-Intl plugin
18-
nextConfig = createNextIntlPlugin('./src/libs/i18n.ts')(nextConfig);
18+
let configWithPlugins = createNextIntlPlugin('./src/libs/i18n.ts')(baseConfig);
1919

2020
// Conditionally enable bundle analysis
2121
if (process.env.ANALYZE === 'true') {
22-
nextConfig = withBundleAnalyzer()(nextConfig);
22+
configWithPlugins = withBundleAnalyzer()(configWithPlugins);
2323
}
2424

25-
// Sentry configuration
26-
const sentryOptions = {
27-
// For all available options, see:
28-
// https://github.com/getsentry/sentry-webpack-plugin#options
29-
// FIXME: Add your Sentry organization and project names
30-
org: 'nextjs-boilerplate-org',
31-
project: 'nextjs-boilerplate',
32-
33-
// Only print logs for uploading source maps in CI
34-
silent: !process.env.CI,
35-
36-
// For all available options, see:
37-
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
38-
39-
// Upload a larger set of source maps for prettier stack traces (increases build time)
40-
widenClientFileUpload: true,
41-
42-
// Automatically annotate React components to show their full name in breadcrumbs and session replay
43-
reactComponentAnnotation: {
44-
enabled: true,
45-
},
46-
47-
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
48-
// This can increase your server load as well as your hosting bill.
49-
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
50-
// side errors will fail.
51-
tunnelRoute: '/monitoring',
52-
53-
// Hides source maps from generated client bundles
54-
hideSourceMaps: true,
55-
56-
// Automatically tree-shake Sentry logger statements to reduce bundle size
57-
disableLogger: true,
58-
59-
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
60-
// See the following for more information:
61-
// https://docs.sentry.io/product/crons/
62-
// https://vercel.com/docs/cron-jobs
63-
automaticVercelMonitors: true,
64-
65-
// Disable Sentry telemetry
66-
telemetry: false,
67-
};
25+
// Conditionally enable Sentry configuration
26+
if (!process.env.NEXT_PUBLIC_SENTRY_DISABLED) {
27+
configWithPlugins = withSentryConfig(configWithPlugins, {
28+
// For all available options, see:
29+
// https://www.npmjs.com/package/@sentry/webpack-plugin#options
30+
// FIXME: Add your Sentry organization and project names
31+
org: 'nextjs-boilerplate-org',
32+
project: 'nextjs-boilerplate',
33+
34+
// Only print logs for uploading source maps in CI
35+
silent: !process.env.CI,
36+
37+
// For all available options, see:
38+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
39+
40+
// Upload a larger set of source maps for prettier stack traces (increases build time)
41+
widenClientFileUpload: true,
42+
43+
// Upload a larger set of source maps for prettier stack traces (increases build time)
44+
reactComponentAnnotation: {
45+
enabled: true,
46+
},
47+
48+
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
49+
// This can increase your server load as well as your hosting bill.
50+
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
51+
// side errors will fail.
52+
tunnelRoute: '/monitoring',
53+
54+
// Automatically tree-shake Sentry logger statements to reduce bundle size
55+
disableLogger: true,
56+
57+
// Disable Sentry telemetry
58+
telemetry: false,
59+
});
60+
}
6861

69-
export default withSentryConfig(nextConfig, sentryOptions);
62+
const nextConfig = configWithPlugins;
63+
export default nextConfig;

0 commit comments

Comments
 (0)