Skip to content

Commit a3bf938

Browse files
authored
chore: do not use withSentryConfig for dev/e2e next config if not needed (#8629)
This fixes this error when executing particular e2e test with playwright extension <img width="347" alt="image" src="https://github.com/user-attachments/assets/5f7608fc-7896-4014-b312-a0c36f21b7d1">
1 parent a70b193 commit a3bf938

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

instrumentation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export async function register() {
2-
if (process.env.NEXT_RUNTIME === 'nodejs') {
2+
if (process.env.NEXT_RUNTIME === 'nodejs' && process.env.NEXT_PUBLIC_SENTRY_DSN) {
33
await import('./sentry.server.config.js')
44
}
55
}

next.config.mjs

+13-4
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,21 @@ const config = withBundleAnalyzer(
4242
'.mjs': ['.mts', '.mjs'],
4343
}
4444

45+
// Ignore sentry warnings when not wrapped with withSentryConfig
46+
webpackConfig.ignoreWarnings = [
47+
...(webpackConfig.ignoreWarnings ?? []),
48+
{ file: /esm\/platform\/node\/instrumentation.js/ },
49+
{ module: /esm\/platform\/node\/instrumentation.js/ },
50+
]
51+
4552
return webpackConfig
4653
},
4754
}),
4855
)
4956

50-
export default withSentryConfig(config, {
51-
telemetry: false,
52-
tunnelRoute: '/monitoring-tunnel',
53-
})
57+
export default process.env.NEXT_PUBLIC_SENTRY_DSN
58+
? withSentryConfig(config, {
59+
telemetry: false,
60+
tunnelRoute: '/monitoring-tunnel',
61+
})
62+
: config

0 commit comments

Comments
 (0)