@multiplayer-app/session-recorder-browser 2.0.39 → 2.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25163,7 +25163,7 @@ const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
25163
25163
  const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
25164
25164
  const REMOTE_SESSION_RECORDING_START = 'remote-session-recording:start';
25165
25165
  const REMOTE_SESSION_RECORDING_STOP = 'remote-session-recording:stop';
25166
- const PACKAGE_VERSION_EXPORT = "2.0.39" || 0;
25166
+ const PACKAGE_VERSION_EXPORT = "2.0.41" || 0;
25167
25167
  // Regex patterns for OpenTelemetry ignore URLs
25168
25168
  const OTEL_IGNORE_URLS = [
25169
25169
  // Traces endpoint
@@ -28539,10 +28539,14 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
28539
28539
  }
28540
28540
  _startBufferOnlyRecording() {
28541
28541
  var _a, _b;
28542
- if (this.sessionId ||
28543
- !this._crashBuffer ||
28544
- !((_b = (_a = this._configs) === null || _a === void 0 ? void 0 : _a.buffering) === null || _b === void 0 ? void 0 : _b.enabled) ||
28545
- this.sessionState !== _types__WEBPACK_IMPORTED_MODULE_4__.SessionState.stopped) {
28542
+ // NOTE: `this.sessionId` is intentionally NOT checked. `_stop()` runs
28543
+ // before `_clearSession()` (the stopSession API call sits between them),
28544
+ // so the clear().then() chain fires while sessionId is still set.
28545
+ // Bailing on sessionId here meant rrweb never restarted after manual
28546
+ // stop, leaving the buffer with no FullSnapshot and silently breaking
28547
+ // exception-triggered flushBuffer. `_recorder.restart(null, ...)` passes
28548
+ // null explicitly, so it's safe regardless of `this.sessionId`.
28549
+ if (!this._crashBuffer || !((_b = (_a = this._configs) === null || _a === void 0 ? void 0 : _a.buffering) === null || _b === void 0 ? void 0 : _b.enabled) || this.sessionState !== _types__WEBPACK_IMPORTED_MODULE_4__.SessionState.stopped) {
28546
28550
  return;
28547
28551
  }
28548
28552
  void this._recorder.restart(null, _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.SessionType.MANUAL);
@@ -28612,9 +28616,10 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
28612
28616
  async stop(comment) {
28613
28617
  try {
28614
28618
  this._checkOperation('stop');
28619
+ const sid = this.sessionId;
28615
28620
  this._stop();
28616
28621
  if (this.continuousRecording) {
28617
- await this._apiService.stopContinuousDebugSession(this.sessionId);
28622
+ await this._apiService.stopContinuousDebugSession(sid);
28618
28623
  this.sessionType = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.SessionType.MANUAL;
28619
28624
  }
28620
28625
  else {
@@ -28622,10 +28627,9 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
28622
28627
  sessionAttributes: { comment },
28623
28628
  stoppedAt: this._recorder.stoppedAt,
28624
28629
  };
28625
- const response = await this._apiService.stopSession(this.sessionId, request);
28630
+ const response = await this._apiService.stopSession(sid, request);
28626
28631
  _eventBus__WEBPACK_IMPORTED_MODULE_7__.recorderEventBus.emit(_config__WEBPACK_IMPORTED_MODULE_5__.SESSION_RESPONSE, response);
28627
28632
  }
28628
- this._clearSession();
28629
28633
  }
28630
28634
  catch (error) {
28631
28635
  this.error = error.message;
@@ -28661,15 +28665,15 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
28661
28665
  async cancel() {
28662
28666
  try {
28663
28667
  this._checkOperation('cancel');
28668
+ const sid = this.sessionId;
28664
28669
  this._stop();
28665
28670
  if (this.continuousRecording) {
28666
- await this._apiService.stopContinuousDebugSession(this.sessionId);
28671
+ await this._apiService.stopContinuousDebugSession(sid);
28667
28672
  this.sessionType = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.SessionType.MANUAL;
28668
28673
  }
28669
28674
  else {
28670
- await this._apiService.cancelSession(this.sessionId);
28675
+ await this._apiService.cancelSession(sid);
28671
28676
  }
28672
- this._clearSession();
28673
28677
  }
28674
28678
  catch (error) {
28675
28679
  this.error = error.message;
@@ -28983,6 +28987,13 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
28983
28987
  this._tracer.stop();
28984
28988
  this._recorder.stop();
28985
28989
  this._navigationRecorder.stop();
28990
+ // Clear session identity synchronously. The buffer-restart chain and the
28991
+ // error-span-appended listener both gate on `this.sessionId === null`;
28992
+ // deferring this to `_clearSession()` (after the network stopSession
28993
+ // call) left them seeing a stale id and silently no-oping. Callers that
28994
+ // need the id for the stop/cancel API must capture it before _stop().
28995
+ this.session = null;
28996
+ this.sessionId = null;
28986
28997
  // rrweb assigns new node IDs on each record() call, so the next buffer
28987
28998
  // segment must not carry events from the previous generation. Await the
28988
28999
  // clear so its IDB tx can't race past the fresh FullSnapshot.