File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ export function init(options: NodeOptions = {}): void {
9797 if ( detectedRelease !== undefined ) {
9898 options . release = detectedRelease ;
9999 }
100+ } else if ( typeof options . release !== 'string' ) {
101+ options . release = JSON . stringify ( options . release ) ;
100102 }
101103
102104 if ( options . environment === undefined && process . env . SENTRY_ENVIRONMENT ) {
Original file line number Diff line number Diff line change @@ -279,6 +279,13 @@ describe('SentryNode initialization', () => {
279279 global . SENTRY_RELEASE = undefined ;
280280 } ) ;
281281
282+ test ( 'release is stringified, if options.release is passed as an object' , ( ) => {
283+ const releaseObj = { name : 'release hello world' } ;
284+ // @ts -ignore
285+ init ( { dsn, release : releaseObj } ) ;
286+ expect ( global . __SENTRY__ . hub . _stack [ 0 ] . client . getOptions ( ) . release ) . toEqual ( JSON . stringify ( releaseObj ) ) ;
287+ } ) ;
288+
282289 describe ( 'SDK metadata' , ( ) => {
283290 it ( 'should set SDK data when Sentry.init() is called' , ( ) => {
284291 init ( { dsn } ) ;
You can’t perform that action at this time.
0 commit comments