Skip to content

Commit 7488a8d

Browse files
authored
Merge pull request #29 from chrisweb/preview
update sentry setup
2 parents c9c248f + 86f9095 commit 7488a8d

8 files changed

+183
-223
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ node_modules/
3434
.sentryclirc
3535

3636
# localhost ssl certificate(s)
37-
certificates
37+
certificates
38+
# Sentry Config File
39+
.env.sentry-build-plugin

instrumentation.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export async function register() {
2-
if (process.env.NEXT_RUNTIME === 'nodejs') {
3-
await import('./sentry.server.config')
4-
}
2+
if (process.env.NEXT_RUNTIME === 'nodejs') {
3+
await import('./sentry.server.config')
4+
}
55

6-
if (process.env.NEXT_RUNTIME === 'edge') {
7-
await import('./sentry.edge.config')
8-
}
6+
if (process.env.NEXT_RUNTIME === 'edge') {
7+
await import('./sentry.edge.config')
8+
}
99
}

next.config.mjs

+34-32
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { withSentryConfig } from '@sentry/nextjs';
1+
import { withSentryConfig } from '@sentry/nextjs'
22
// uncomment the following lines if you want to use the bundle analyzer
33
//import WithBundleAnalyzer from '@next/bundle-analyzer'
44
import { PHASE_DEVELOPMENT_SERVER } from 'next/constants.js'
@@ -390,43 +390,45 @@ const securityHeadersConfig = (phase) => {
390390

391391
}
392392

393-
export default withSentryConfig(nextConfig, {
394-
// For all available options, see:
395-
// https://github.com/getsentry/sentry-webpack-plugin#options
393+
export default withSentryConfig(
394+
nextConfig,
395+
{
396+
// For all available options, see:
397+
// https://github.com/getsentry/sentry-webpack-plugin#options
396398

397-
telemetry: false,
399+
org: "chrisweb",
400+
project: "javascript-nextjs",
398401

399-
org: "chrisweb",
400-
project: "javascript-nextjs",
402+
// Only print logs for uploading source maps in CI
403+
silent: !process.env.CI,
401404

402-
// Only print logs for uploading source maps in CI
403-
silent: !process.env.CI,
405+
// For all available options, see:
406+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
404407

405-
// For all available options, see:
406-
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
408+
// Upload a larger set of source maps for prettier stack traces (increases build time)
409+
widenClientFileUpload: true,
407410

408-
// Upload a larger set of source maps for prettier stack traces (increases build time)
409-
widenClientFileUpload: true,
410-
411-
// Transpiles SDK to be compatible with IE11 (increases bundle size)
412-
transpileClientSDK: true,
411+
// Automatically annotate React components to show their full name in breadcrumbs and session replay
412+
reactComponentAnnotation: {
413+
enabled: true,
414+
},
413415

414-
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
415-
// This can increase your server load as well as your hosting bill.
416-
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
417-
// side errors will fail.
418-
tunnelRoute: "/monitoring",
416+
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
417+
// This can increase your server load as well as your hosting bill.
418+
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
419+
// side errors will fail.
420+
tunnelRoute: "/monitoring",
419421

420-
// Hides source maps from generated client bundles
421-
hideSourceMaps: true,
422+
// Hides source maps from generated client bundles
423+
hideSourceMaps: true,
422424

423-
// Automatically tree-shake Sentry logger statements to reduce bundle size
424-
disableLogger: true,
425+
// Automatically tree-shake Sentry logger statements to reduce bundle size
426+
disableLogger: true,
425427

426-
// Enables automatic instrumentation of Vercel Cron Monitors.
427-
// (Does not yet work with App Router route handlers.)
428-
// See the following for more information:
429-
// https://docs.sentry.io/product/crons/
430-
// https://vercel.com/docs/cron-jobs
431-
automaticVercelMonitors: false,
432-
})
428+
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
429+
// See the following for more information:
430+
// https://docs.sentry.io/product/crons/
431+
// https://vercel.com/docs/cron-jobs
432+
automaticVercelMonitors: true,
433+
}
434+
)

0 commit comments

Comments
 (0)