From 8231b07c76e67dde06f1c1fee240aa9ac3dcb81e Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Wed, 5 Jul 2023 09:28:40 +0000 Subject: [PATCH 1/3] fix(nextjs): Use `basePath` option for `tunnelRoute` --- packages/nextjs/src/config/webpack.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index bb5ef56ce4ad..8c8193847f58 100644 --- a/packages/nextjs/src/config/webpack.ts +++ b/packages/nextjs/src/config/webpack.ts @@ -865,7 +865,7 @@ function addValueInjectionLoader( const isomorphicValues = { // `rewritesTunnel` set by the user in Next.js config - __sentryRewritesTunnelPath__: userSentryOptions.tunnelRoute, + __sentryRewritesTunnelPath__: `${userNextConfig.basePath ?? ''}${userSentryOptions.tunnelRoute}`, // The webpack plugin's release injection breaks the `app` directory so we inject the release manually here instead. // Having a release defined in dev-mode spams releases in Sentry so we only set one in non-dev mode From d041f67abef4db514b5888e13f3295f111fc9eee Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Wed, 5 Jul 2023 10:11:43 +0000 Subject: [PATCH 2/3] Handle undefined case --- packages/nextjs/src/config/webpack.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index 8c8193847f58..60553cb1e231 100644 --- a/packages/nextjs/src/config/webpack.ts +++ b/packages/nextjs/src/config/webpack.ts @@ -865,7 +865,7 @@ function addValueInjectionLoader( const isomorphicValues = { // `rewritesTunnel` set by the user in Next.js config - __sentryRewritesTunnelPath__: `${userNextConfig.basePath ?? ''}${userSentryOptions.tunnelRoute}`, + __sentryRewritesTunnelPath__: userSentryOptions.tunnelRoute !== undefined ? `${userNextConfig.basePath ?? ''}${userSentryOptions.tunnelRoute}` : undefined, // The webpack plugin's release injection breaks the `app` directory so we inject the release manually here instead. // Having a release defined in dev-mode spams releases in Sentry so we only set one in non-dev mode From 01d1e1d977a49ea3688d2c23c718159f98ed222a Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Wed, 5 Jul 2023 10:22:32 +0000 Subject: [PATCH 3/3] Prettier --- packages/nextjs/src/config/webpack.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index 60553cb1e231..6eac3d702d00 100644 --- a/packages/nextjs/src/config/webpack.ts +++ b/packages/nextjs/src/config/webpack.ts @@ -865,7 +865,10 @@ function addValueInjectionLoader( const isomorphicValues = { // `rewritesTunnel` set by the user in Next.js config - __sentryRewritesTunnelPath__: userSentryOptions.tunnelRoute !== undefined ? `${userNextConfig.basePath ?? ''}${userSentryOptions.tunnelRoute}` : undefined, + __sentryRewritesTunnelPath__: + userSentryOptions.tunnelRoute !== undefined + ? `${userNextConfig.basePath ?? ''}${userSentryOptions.tunnelRoute}` + : undefined, // The webpack plugin's release injection breaks the `app` directory so we inject the release manually here instead. // Having a release defined in dev-mode spams releases in Sentry so we only set one in non-dev mode