rollbar 2.24.0 → 2.25.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.
@@ -1,14 +1,23 @@
1
1
  ## Description of the change
2
2
 
3
- > Description here
3
+ > Please include a summary of the change and which issues are fixed.
4
+ > Please also include relevant motivation and context.
5
+
4
6
  ## Type of change
7
+
5
8
  - [ ] Bug fix (non-breaking change that fixes an issue)
6
9
  - [ ] New feature (non-breaking change that adds functionality)
7
10
  - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
11
+ - [ ] Maintenance
12
+ - [ ] New release
8
13
 
9
14
  ## Related issues
10
15
 
11
- > Fix [#1]()
16
+ > Shortcut stories and GitHub issues (delete irrelevant)
17
+
18
+ - Fix [SC-]
19
+ - Fix #1
20
+
12
21
  ## Checklists
13
22
 
14
23
  ### Development
@@ -17,9 +26,9 @@
17
26
  - [ ] The code changed/added as part of this pull request has been covered with tests
18
27
  - [ ] All tests related to the changed code pass in development
19
28
 
20
- ### Code review
29
+ ### Code review
21
30
 
22
- - [ ] This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
23
- - [ ] "Ready for review" label attached to the PR and reviewers mentioned in a comment
31
+ - [ ] This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
32
+ - [ ] "Ready for review" label attached to the PR and reviewers assigned
33
+ - [ ] Issue from task tracker has a link to this pull request
24
34
  - [ ] Changes have been reviewed by at least one other engineer
25
- - [ ] Issue from task tracker has a link to this pull request
@@ -9,7 +9,7 @@ on:
9
9
 
10
10
  jobs:
11
11
  build:
12
- runs-on: ubuntu-16.04
12
+ runs-on: ubuntu-18.04
13
13
  strategy:
14
14
  matrix:
15
15
  node-version: [8, 10, 12, 14, 16]
package/dist/rollbar.js CHANGED
@@ -491,6 +491,37 @@ function wrapCallback(logger, f) {
491
491
  };
492
492
  }
493
493
 
494
+ function nonCircularClone(obj) {
495
+ var seen = [obj];
496
+
497
+ function clone(obj, seen) {
498
+ var value, name, newSeen, result = {};
499
+
500
+ try {
501
+ for (name in obj) {
502
+ value = obj[name];
503
+
504
+ if (value && (isType(value, 'object') || isType(value, 'array'))) {
505
+ if (seen.includes(value)) {
506
+ result[name] = 'Removed circular reference: ' + typeName(value);
507
+ } else {
508
+ newSeen = seen.slice();
509
+ newSeen.push(value);
510
+ result[name] = clone(value, newSeen);
511
+ }
512
+ continue;
513
+ }
514
+
515
+ result[name] = value;
516
+ }
517
+ } catch (e) {
518
+ result = 'Failed cloning custom data: ' + e.message;
519
+ }
520
+ return result;
521
+ }
522
+ return clone(obj, seen);
523
+ }
524
+
494
525
  function createItem(args, logger, notifier, requestKeys, lambdaContext) {
495
526
  var message, err, custom, callback, request;
496
527
  var arg;
@@ -548,10 +579,12 @@ function createItem(args, logger, notifier, requestKeys, lambdaContext) {
548
579
  }
549
580
  }
550
581
 
582
+ // if custom is an array this turns it into an object with integer keys
583
+ if (custom) custom = nonCircularClone(custom);
584
+
551
585
  if (extraArgs.length > 0) {
552
- // if custom is an array this turns it into an object with integer keys
553
- custom = merge(custom);
554
- custom.extraArgs = extraArgs;
586
+ if (!custom) custom = nonCircularClone({});
587
+ custom.extraArgs = nonCircularClone(extraArgs);
555
588
  }
556
589
 
557
590
  var item = {
@@ -596,7 +629,7 @@ function addErrorContext(item, errors) {
596
629
  try {
597
630
  for (var i = 0; i < errors.length; ++i) {
598
631
  if (errors[i].hasOwnProperty('rollbarContext')) {
599
- custom = merge(custom, errors[i].rollbarContext);
632
+ custom = merge(custom, nonCircularClone(errors[i].rollbarContext));
600
633
  contextAdded = true;
601
634
  }
602
635
  }
@@ -1051,11 +1084,11 @@ function Stack(exception, skip) {
1051
1084
  function parse(e, skip) {
1052
1085
  var err = e;
1053
1086
 
1054
- if (err.nested) {
1087
+ if (err.nested || err.cause) {
1055
1088
  var traceChain = [];
1056
1089
  while (err) {
1057
1090
  traceChain.push(new Stack(err, skip));
1058
- err = err.nested;
1091
+ err = err.nested || err.cause;
1059
1092
 
1060
1093
  skip = 0; // Only apply skip value to primary error
1061
1094
  }
@@ -2864,7 +2897,12 @@ function Api(options, transport, urllib, truncation, jsonBackup) {
2864
2897
  Api.prototype.postItem = function(data, callback) {
2865
2898
  var transportOptions = helpers.transportOptions(this.transportOptions, 'POST');
2866
2899
  var payload = helpers.buildPayload(this.accessToken, data, this.jsonBackup);
2867
- this.transport.post(this.accessToken, transportOptions, payload, callback);
2900
+ var self = this;
2901
+
2902
+ // ensure the network request is scheduled after the current tick.
2903
+ setTimeout(function() {
2904
+ self.transport.post(self.accessToken, transportOptions, payload, callback);
2905
+ }, 0);
2868
2906
  };
2869
2907
 
2870
2908
  /**
@@ -3512,8 +3550,8 @@ function addErrorContext(item) {
3512
3550
 
3513
3551
  chain.push(err);
3514
3552
 
3515
- while (err.nested) {
3516
- err = err.nested;
3553
+ while (err.nested || err.cause) {
3554
+ err = err.nested || err.cause;
3517
3555
  chain.push(err);
3518
3556
  }
3519
3557
 
@@ -4546,7 +4584,7 @@ module.exports = {
4546
4584
 
4547
4585
 
4548
4586
  module.exports = {
4549
- version: '2.24.0',
4587
+ version: '2.25.1',
4550
4588
  endpoint: 'api.rollbar.com/api/1/item/',
4551
4589
  logLevel: 'debug',
4552
4590
  reportLevel: 'debug',
@@ -5222,8 +5260,10 @@ Instrumenter.prototype.instrumentNetwork = function() {
5222
5260
  // Test to ensure body is a Promise, which it should always be.
5223
5261
  if (typeof body.then === 'function') {
5224
5262
  body.then(function (text) {
5225
- if (self.isJsonContentType(metadata.response_content_type)) {
5263
+ if (text && self.isJsonContentType(metadata.response_content_type)) {
5226
5264
  metadata.response.body = self.scrubJson(text);
5265
+ } else {
5266
+ metadata.response.body = text;
5227
5267
  }
5228
5268
  });
5229
5269
  } else {
@@ -5548,16 +5588,16 @@ Instrumenter.prototype.handleCspError = function(message) {
5548
5588
  }
5549
5589
 
5550
5590
  Instrumenter.prototype.deinstrumentContentSecurityPolicy = function() {
5551
- if (!('addEventListener' in this._window)) { return; }
5591
+ if (!('addEventListener' in this._document)) { return; }
5552
5592
 
5553
5593
  this.removeListeners('contentsecuritypolicy');
5554
5594
  };
5555
5595
 
5556
5596
  Instrumenter.prototype.instrumentContentSecurityPolicy = function() {
5557
- if (!('addEventListener' in this._window)) { return; }
5597
+ if (!('addEventListener' in this._document)) { return; }
5558
5598
 
5559
5599
  var cspHandler = this.handleCspEvent.bind(this);
5560
- this.addListener('contentsecuritypolicy', this._window, 'securitypolicyviolation', null, cspHandler, false);
5600
+ this.addListener('contentsecuritypolicy', this._document, 'securitypolicyviolation', null, cspHandler, false);
5561
5601
  };
5562
5602
 
5563
5603
  Instrumenter.prototype.addListener = function(section, obj, type, altType, handler, capture) {