diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index bb5ef56ce4ad..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, + __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