@@ -158,8 +158,6 @@ export class ReplayContainer {
158158 // when an error will occur, so we need to keep a buffer of
159159 // replay events.
160160 if ( this . session . sampled === 'error' ) {
161- // Checkout every minute, meaning we only get up-to one minute of events before the error happens
162- this . recordingOptions . checkoutEveryNms = 60000 ;
163161 this . _waitForError = true ;
164162 }
165163
@@ -187,6 +185,10 @@ export class ReplayContainer {
187185 try {
188186 this . _stopRecording = record ( {
189187 ...this . recordingOptions ,
188+ // When running in error sampling mode, we need to overwrite `checkoutEveryNth`
189+ // Without this, it would record forever, until an error happens, which we don't want
190+ // instead, we'll always keep the last 60 seconds of replay before an error happened
191+ ...( this . _waitForError && { checkoutEveryNth : 60000 } ) ,
190192 emit : this . handleRecordingEmit ,
191193 } ) ;
192194 } catch ( err ) {
@@ -470,7 +472,6 @@ export class ReplayContainer {
470472 this . _stopRecording ( ) ;
471473 // Reset all "capture on error" configuration before
472474 // starting a new recording
473- delete this . recordingOptions . checkoutEveryNms ;
474475 this . _waitForError = false ;
475476 this . startRecording ( ) ;
476477 }
0 commit comments