@@ -50,6 +50,8 @@ function getFinalConfigObject(
5050 incomingUserNextConfigObject : NextConfigObject ,
5151 userSentryOptions : SentryBuildOptions ,
5252) : NextConfigObject {
53+ const releaseName = userSentryOptions . release ?. name ?? getSentryRelease ( ) ?? getGitRevision ( ) ;
54+
5355 if ( userSentryOptions ?. tunnelRoute ) {
5456 if ( incomingUserNextConfigObject . output === 'export' ) {
5557 if ( ! showedExportModeTunnelWarning ) {
@@ -64,7 +66,7 @@ function getFinalConfigObject(
6466 }
6567 }
6668
67- setUpBuildTimeVariables ( incomingUserNextConfigObject , userSentryOptions ) ;
69+ setUpBuildTimeVariables ( incomingUserNextConfigObject , userSentryOptions , releaseName ) ;
6870
6971 const nextJsVersion = getNextjsVersion ( ) ;
7072
@@ -207,8 +209,6 @@ function getFinalConfigObject(
207209 ) ;
208210 }
209211
210- const releaseName = userSentryOptions . release ?. name ?? getSentryRelease ( ) ?? getGitRevision ( ) ;
211-
212212 return {
213213 ...incomingUserNextConfigObject ,
214214 webpack : constructWebpackConfigFunction ( incomingUserNextConfigObject , userSentryOptions , releaseName ) ,
@@ -291,8 +291,11 @@ function setUpTunnelRewriteRules(userNextConfig: NextConfigObject, tunnelPath: s
291291 } ;
292292}
293293
294- // TODO: For Turbopack we need to pass the release name here and pick it up in the SDK
295- function setUpBuildTimeVariables ( userNextConfig : NextConfigObject , userSentryOptions : SentryBuildOptions ) : void {
294+ function setUpBuildTimeVariables (
295+ userNextConfig : NextConfigObject ,
296+ userSentryOptions : SentryBuildOptions ,
297+ releaseName : string | undefined ,
298+ ) : void {
296299 const assetPrefix = userNextConfig . assetPrefix || userNextConfig . basePath || '' ;
297300 const basePath = userNextConfig . basePath ?? '' ;
298301 const rewritesTunnelPath =
@@ -335,6 +338,10 @@ function setUpBuildTimeVariables(userNextConfig: NextConfigObject, userSentryOpt
335338 buildTimeVariables . _experimentalThirdPartyOriginStackFrames = 'true' ;
336339 }
337340
341+ if ( releaseName ) {
342+ buildTimeVariables . _sentryRelease = releaseName ;
343+ }
344+
338345 if ( typeof userNextConfig . env === 'object' ) {
339346 userNextConfig . env = { ...buildTimeVariables , ...userNextConfig . env } ;
340347 } else if ( userNextConfig . env === undefined ) {
0 commit comments