@@ -50,6 +50,8 @@ function getFinalConfigObject(
50
50
incomingUserNextConfigObject : NextConfigObject ,
51
51
userSentryOptions : SentryBuildOptions ,
52
52
) : NextConfigObject {
53
+ const releaseName = userSentryOptions . release ?. name ?? getSentryRelease ( ) ?? getGitRevision ( ) ;
54
+
53
55
if ( userSentryOptions ?. tunnelRoute ) {
54
56
if ( incomingUserNextConfigObject . output === 'export' ) {
55
57
if ( ! showedExportModeTunnelWarning ) {
@@ -64,7 +66,7 @@ function getFinalConfigObject(
64
66
}
65
67
}
66
68
67
- setUpBuildTimeVariables ( incomingUserNextConfigObject , userSentryOptions ) ;
69
+ setUpBuildTimeVariables ( incomingUserNextConfigObject , userSentryOptions , releaseName ) ;
68
70
69
71
const nextJsVersion = getNextjsVersion ( ) ;
70
72
@@ -207,8 +209,6 @@ function getFinalConfigObject(
207
209
) ;
208
210
}
209
211
210
- const releaseName = userSentryOptions . release ?. name ?? getSentryRelease ( ) ?? getGitRevision ( ) ;
211
-
212
212
return {
213
213
...incomingUserNextConfigObject ,
214
214
webpack : constructWebpackConfigFunction ( incomingUserNextConfigObject , userSentryOptions , releaseName ) ,
@@ -291,8 +291,11 @@ function setUpTunnelRewriteRules(userNextConfig: NextConfigObject, tunnelPath: s
291
291
} ;
292
292
}
293
293
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 {
296
299
const assetPrefix = userNextConfig . assetPrefix || userNextConfig . basePath || '' ;
297
300
const basePath = userNextConfig . basePath ?? '' ;
298
301
const rewritesTunnelPath =
@@ -335,6 +338,10 @@ function setUpBuildTimeVariables(userNextConfig: NextConfigObject, userSentryOpt
335
338
buildTimeVariables . _experimentalThirdPartyOriginStackFrames = 'true' ;
336
339
}
337
340
341
+ if ( releaseName ) {
342
+ buildTimeVariables . _sentryRelease = releaseName ;
343
+ }
344
+
338
345
if ( typeof userNextConfig . env === 'object' ) {
339
346
userNextConfig . env = { ...buildTimeVariables , ...userNextConfig . env } ;
340
347
} else if ( userNextConfig . env === undefined ) {
0 commit comments