Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from nodejs:main #312

Merged
merged 1 commit into from
Nov 15, 2023
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
49 changes: 31 additions & 18 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,28 +65,41 @@ const nextConfig = {
],
// Removes the warning regarding the WebPack Build Worker
webpackBuildWorker: false,
// Otherwise Build fails due to unrecognizable character
// Sentry Profiling Module should be treated as an external symbol
serverComponentsExternalPackages: ['@sentry/profiling-node'],
},
};

// Next.js Config with i18n Configuration
const withIntlConfig = withNextIntl()(nextConfig);
/** @type {import('@sentry/cli').SentryCliOptions} */
const sentrySettings = {
// We don't want Sentry to emit logs
silent: true,
// Define the Sentry Organisation
org: 'nodejs-org',
// Define the Sentry Project on our Sentry Organisation
project: 'nodejs-org',
};

/** @type {import('@sentry/nextjs/types/config/types').UserSentryOptions} */
const sentryConfig = {
// Upload Next.js or third-party code in addition to our code
widenClientFileUpload: true,
// Transpile the Sentry code too since we target older browsers in our .browserslistrc
transpileClientSDK: true,
// Attempt to circumvent ad blockers
tunnelRoute: ENABLE_STATIC_EXPORT ? undefined : '/monitoring',
// Prevent source map comments in built files
hideSourceMaps: false,
// Tree shake Sentry stuff from the bundle
disableLogger: true,
};

// Next.js Config with Sentry configuration
// Next.js Config with Sentry Configuration
export default withSentryConfig(
withIntlConfig,
{ silent: true, org: 'nodejs-org', project: 'nodejs-org' },
{
// upload Next.js or third-party code in addition to our code
widenClientFileUpload: true,
// transpile the Sentry code too since we target older browsers in our .browserslistrc
transpileClientSDK: true,
// attempt to circumvent ad blockers
tunnelRoute: ENABLE_STATIC_EXPORT ? undefined : '/monitoring',
// prevent source map comments in built files
hideSourceMaps: false,
// tree shake sentry stuff from the bundle
disableLogger: true,
}
// Next.js Config with i18n Configuration
withNextIntl()(nextConfig),
// Default Sentry Settings
sentrySettings,
// Default Sentry Extension Configuration
sentryConfig
);
18 changes: 10 additions & 8 deletions sentry.client.config.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import { init, Replay } from '@sentry/nextjs';

import { SENTRY_DSN } from '@/next.constants.mjs';
import { SENTRY_DSN, VERCEL_ENV } from '@/next.constants.mjs';

init({
// tell Sentry where to send events
// Only run Sentry on Vercel Environment
enabled: !!VERCEL_ENV,
// Tell Sentry where to send events
dsn: SENTRY_DSN,
// percentage of events to send to Sentry (all of them) (for performance metrics)
// Percentage of events to send to Sentry (all of them) (for performance metrics)
tracesSampleRate: 1,
// percentage of errors to sample (all of them)
// Percentage of errors to sample (all of them)
replaysOnErrorSampleRate: 1.0,
// percentage of sessionsto sample (10%)
// Percentage of sessionsto sample (10%)
replaysSessionSampleRate: 0.1,
// support replaying client sessions to capture unhappy paths
// Support replaying client sessions to capture unhappy paths
integrations: [new Replay()],
// we only want to capture errors from _next folder on production
// we don't want to capture errors from preview branches here
// We only want to capture errors from _next folder on production
// We don't want to capture errors from preview branches here
allowUrls: ['https://nodejs.org/_next'],
// Filter-out Events/Errors that are invalid for us
beforeSend: (event, hint) => {
Expand Down
11 changes: 9 additions & 2 deletions sentry.edge.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { init } from '@sentry/nextjs';

import { SENTRY_DSN } from '@/next.constants.mjs';
import { SENTRY_DSN, VERCEL_ENV } from '@/next.constants.mjs';

init({ dsn: SENTRY_DSN, tracesSampleRate: 1 });
init({
// Only run Sentry on Vercel Environment
enabled: !!VERCEL_ENV,
// Tell Sentry where to send events
dsn: SENTRY_DSN,
// Percentage of events to send to Sentry (all of them) (for performance metrics)
tracesSampleRate: 1,
});
12 changes: 7 additions & 5 deletions sentry.server.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { init } from '@sentry/nextjs';
import { ProfilingIntegration } from '@sentry/profiling-node';

import { SENTRY_DSN } from '@/next.constants.mjs';
import { SENTRY_DSN, VERCEL_ENV } from '@/next.constants.mjs';

init({
// tell Sentry where to send events
// Only run Sentry on Vercel Environment
enabled: !!VERCEL_ENV,
// Tell Sentry where to send events
dsn: SENTRY_DSN,
// percentage of events to send to Sentry (all of them) (for performance metrics)
// Percentage of events to send to Sentry (all of them) (for performance metrics)
tracesSampleRate: 1,
// percentage of events to send to Sentry (all of them) (for profiling metrics)
// Percentage of events to send to Sentry (all of them) (for profiling metrics)
profilesSampleRate: 1.0,
// add profiling integration to capture performance metrics
// Add profiling integration to capture performance metrics
integrations: [new ProfilingIntegration()],
});
Loading