@newrelic/browser-agent 1.261.0 → 1.261.1

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.261.1](https://github.com/newrelic/newrelic-browser-agent/compare/v1.261.0...v1.261.1) (2024-06-26)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Unhandled promise rejection for session import ([#1088](https://github.com/newrelic/newrelic-browser-agent/issues/1088)) ([03efcf3](https://github.com/newrelic/newrelic-browser-agent/commit/03efcf36656ac883c4431829fda1bad6445373a1))
12
+
6
13
  ## [1.261.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.260.1...v1.261.0) (2024-06-26)
7
14
 
8
15
 
@@ -12,7 +12,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
12
12
  /**
13
13
  * Exposes the version of the agent
14
14
  */
15
- const VERSION = exports.VERSION = "1.261.0";
15
+ const VERSION = exports.VERSION = "1.261.1";
16
16
 
17
17
  /**
18
18
  * Exposes the build type of the agent
@@ -12,7 +12,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
12
12
  /**
13
13
  * Exposes the version of the agent
14
14
  */
15
- const VERSION = exports.VERSION = "1.261.0";
15
+ const VERSION = exports.VERSION = "1.261.1";
16
16
 
17
17
  /**
18
18
  * Exposes the build type of the agent
@@ -23,7 +23,7 @@ class AggregateBase extends _featureBase.FeatureBase {
23
23
  */
24
24
  waitForFlags() {
25
25
  let flagNames = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
26
- return new Promise((resolve, reject) => {
26
+ const flagsPromise = new Promise((resolve, reject) => {
27
27
  if (_featureFlags.activatedFeatures[this.agentIdentifier]) {
28
28
  resolve(buildOutput(_featureFlags.activatedFeatures[this.agentIdentifier]));
29
29
  } else {
@@ -39,6 +39,9 @@ class AggregateBase extends _featureBase.FeatureBase {
39
39
  });
40
40
  }
41
41
  });
42
+ return flagsPromise.catch(err => {
43
+ this.ee.emit('internal-error', [err]);
44
+ });
42
45
  }
43
46
  drain() {
44
47
  (0, _drain.drain)(this.agentIdentifier, this.featureName);
@@ -93,6 +93,7 @@ class InstrumentBase extends _featureBase.FeatureBase {
93
93
  }
94
94
  } catch (e) {
95
95
  (0, _console.warn)('A problem occurred when starting up session manager. This page will not start or extend any session.', e);
96
+ this.ee.emit('internal-error', [e]);
96
97
  if (this.featureName === _features.FEATURE_NAMES.sessionReplay) this.abortHandler?.(); // SR should stop recording if session DNE
97
98
  }
98
99
 
@@ -137,7 +138,7 @@ class InstrumentBase extends _featureBase.FeatureBase {
137
138
  */
138
139
  #shouldImportAgg(featureName, session) {
139
140
  if (featureName === _features.FEATURE_NAMES.sessionReplay) return (0, _utils.canImportReplayAgg)(this.agentIdentifier, session);
140
- return true;
141
+ return !(featureName === _features.FEATURE_NAMES.sessionTrace && !session);
141
142
  }
142
143
  }
143
144
  exports.InstrumentBase = InstrumentBase;
@@ -6,7 +6,7 @@
6
6
  /**
7
7
  * Exposes the version of the agent
8
8
  */
9
- export const VERSION = "1.261.0";
9
+ export const VERSION = "1.261.1";
10
10
 
11
11
  /**
12
12
  * Exposes the build type of the agent
@@ -6,7 +6,7 @@
6
6
  /**
7
7
  * Exposes the version of the agent
8
8
  */
9
- export const VERSION = "1.261.0";
9
+ export const VERSION = "1.261.1";
10
10
 
11
11
  /**
12
12
  * Exposes the build type of the agent
@@ -17,7 +17,7 @@ export class AggregateBase extends FeatureBase {
17
17
  */
18
18
  waitForFlags() {
19
19
  let flagNames = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
20
- return new Promise((resolve, reject) => {
20
+ const flagsPromise = new Promise((resolve, reject) => {
21
21
  if (activatedFeatures[this.agentIdentifier]) {
22
22
  resolve(buildOutput(activatedFeatures[this.agentIdentifier]));
23
23
  } else {
@@ -33,6 +33,9 @@ export class AggregateBase extends FeatureBase {
33
33
  });
34
34
  }
35
35
  });
36
+ return flagsPromise.catch(err => {
37
+ this.ee.emit('internal-error', [err]);
38
+ });
36
39
  }
37
40
  drain() {
38
41
  drain(this.agentIdentifier, this.featureName);
@@ -88,6 +88,7 @@ export class InstrumentBase extends FeatureBase {
88
88
  }
89
89
  } catch (e) {
90
90
  warn('A problem occurred when starting up session manager. This page will not start or extend any session.', e);
91
+ this.ee.emit('internal-error', [e]);
91
92
  if (this.featureName === FEATURE_NAMES.sessionReplay) this.abortHandler?.(); // SR should stop recording if session DNE
92
93
  }
93
94
 
@@ -132,6 +133,6 @@ export class InstrumentBase extends FeatureBase {
132
133
  */
133
134
  #shouldImportAgg(featureName, session) {
134
135
  if (featureName === FEATURE_NAMES.sessionReplay) return canImportReplayAgg(this.agentIdentifier, session);
135
- return true;
136
+ return !(featureName === FEATURE_NAMES.sessionTrace && !session);
136
137
  }
137
138
  }
@@ -1 +1 @@
1
- {"version":3,"file":"aggregate-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/aggregate-base.js"],"names":[],"mappings":"AAOA;IACE,4BAGC;IAED;;;;OAIG;IACH,yBAHW,MAAM,EAAE,gBAmBlB;IAED,cAGC;IADC,6BAAmB;IAGrB;;;OAGG;IACH,2BAqBC;CACF;4BAnE2B,gBAAgB"}
1
+ {"version":3,"file":"aggregate-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/aggregate-base.js"],"names":[],"mappings":"AAOA;IACE,4BAGC;IAED;;;;OAIG;IACH,yBAHW,MAAM,EAAE,gBAsBlB;IAED,cAGC;IADC,6BAAmB;IAGrB;;;OAGG;IACH,2BAqBC;CACF;4BAtE2B,gBAAgB"}
@@ -1 +1 @@
1
- {"version":3,"file":"instrument-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/instrument-base.js"],"names":[],"mappings":"AAiBA;;;GAGG;AACH;IACE;;;;;;;;OAQG;IACH,6BAPW,MAAM,cACN,OAAO,mCAAmC,EAAE,UAAU,eACtD,MAAM,8BAqChB;IA9BC,cAAgB;IAEhB,8IAA8I;IAC9I,cADW,WAAW,SAAS,CACF;IAE7B;;;MAGE;IACF,eAHU,OAAO,kBAAkB,EAAE,aAAa,CAGpB;IAE9B;;;MAGE;IACF,kCAAoC;IAiBtC;;;;;OAKG;IACH,mEAgDC;;CAYF;4BA5H2B,gBAAgB"}
1
+ {"version":3,"file":"instrument-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/instrument-base.js"],"names":[],"mappings":"AAiBA;;;GAGG;AACH;IACE;;;;;;;;OAQG;IACH,6BAPW,MAAM,cACN,OAAO,mCAAmC,EAAE,UAAU,eACtD,MAAM,8BAqChB;IA9BC,cAAgB;IAEhB,8IAA8I;IAC9I,cADW,WAAW,SAAS,CACF;IAE7B;;;MAGE;IACF,eAHU,OAAO,kBAAkB,EAAE,aAAa,CAGpB;IAE9B;;;MAGE;IACF,kCAAoC;IAiBtC;;;;;OAKG;IACH,mEAiDC;;CAYF;4BA7H2B,gBAAgB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.261.0",
3
+ "version": "1.261.1",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "New Relic Browser Agent",
@@ -1 +1,3 @@
1
- export const setupAgentSession = jest.fn()
1
+ export const setupAgentSession = jest.fn(() => {
2
+ return {}
3
+ })
@@ -5,7 +5,8 @@ export const FeatureBase = jest.fn(function (agentIdentifier, aggregator, featur
5
5
 
6
6
  this.ee = {
7
7
  abort: jest.fn(),
8
- on: jest.fn()
8
+ on: jest.fn(),
9
+ emit: jest.fn()
9
10
  }
10
11
  this.blocked = false
11
12
  })
@@ -17,7 +17,7 @@ export class AggregateBase extends FeatureBase {
17
17
  * @returns {Promise}
18
18
  */
19
19
  waitForFlags (flagNames = []) {
20
- return new Promise((resolve, reject) => {
20
+ const flagsPromise = new Promise((resolve, reject) => {
21
21
  if (activatedFeatures[this.agentIdentifier]) {
22
22
  resolve(buildOutput(activatedFeatures[this.agentIdentifier]))
23
23
  } else {
@@ -32,6 +32,9 @@ export class AggregateBase extends FeatureBase {
32
32
  })
33
33
  }
34
34
  })
35
+ return flagsPromise.catch(err => {
36
+ this.ee.emit('internal-error', [err])
37
+ })
35
38
  }
36
39
 
37
40
  drain () {
@@ -86,6 +86,7 @@ export class InstrumentBase extends FeatureBase {
86
86
  }
87
87
  } catch (e) {
88
88
  warn('A problem occurred when starting up session manager. This page will not start or extend any session.', e)
89
+ this.ee.emit('internal-error', [e])
89
90
  if (this.featureName === FEATURE_NAMES.sessionReplay) this.abortHandler?.() // SR should stop recording if session DNE
90
91
  }
91
92
 
@@ -127,6 +128,6 @@ export class InstrumentBase extends FeatureBase {
127
128
  */
128
129
  #shouldImportAgg (featureName, session) {
129
130
  if (featureName === FEATURE_NAMES.sessionReplay) return canImportReplayAgg(this.agentIdentifier, session)
130
- return true
131
+ return !(featureName === FEATURE_NAMES.sessionTrace && !session)
131
132
  }
132
133
  }