aws-xray-sdk-core
Advanced tools
Comparing version 3.0.0 to 3.0.1
# Changelog for AWS X-Ray Core SDK for JavaScript | ||
<!--LATEST=3.0.0--> | ||
<!--LATEST=3.0.1--> | ||
<!--ENTRYINSERT--> | ||
## 3.0.1 | ||
* bugfix: Gracefully handle invalid sampling API responses [#ISSUE285](https://github.com/aws/aws-xray-sdk-node/issues/285) | ||
## 3.0.0 | ||
@@ -5,0 +8,0 @@ * **BREAKING** change: Releasing all changes in 3.0.0-alpha.1 and 3.0.0-alpha.2 as stable. See below changelog entries. [#ISSUE157](https://github.com/aws/aws-xray-sdk-node/issues/157) |
@@ -46,2 +46,6 @@ var crypto = require('crypto'); | ||
if (dataObj === null) { | ||
callback(new Error('AWS X-Ray GetSamplingRules API returned null response')); | ||
} | ||
var newRules = assembleRules(dataObj); | ||
@@ -83,2 +87,6 @@ callback(null, newRules); | ||
if (dataObj === null || !dataObj['LastRuleModification']) { | ||
callback(new Error('AWS X-Ray SamplingTargets API returned invalid response')); | ||
} | ||
var targetsMapping = assembleTargets(dataObj); | ||
@@ -122,3 +130,3 @@ var ruleFreshness = dateToEpoch(dataObj['LastRuleModification']); | ||
var newRules = []; | ||
var ruleList = data['SamplingRuleRecords']; | ||
var ruleList = data['SamplingRuleRecords'] || []; | ||
ruleList.forEach(function(ruleRecord) { | ||
@@ -147,3 +155,3 @@ ruleRecord = ruleRecord['SamplingRule']; | ||
var assembleTargets = function assembleTargets(data) { | ||
var docs = data['SamplingTargetDocuments']; | ||
var docs = data['SamplingTargetDocuments'] || []; | ||
var targetsMapping = {}; | ||
@@ -150,0 +158,0 @@ |
{ | ||
"name": "aws-xray-sdk-core", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "AWS X-Ray SDK for Javascript", | ||
@@ -54,3 +54,3 @@ "author": "Amazon Web Services", | ||
"repository": "https://github.com/aws/aws-xray-sdk-node/tree/master/packages/core", | ||
"gitHead": "bfbc97d88f8452a288dc6396c9cc0f9cffcf45fd" | ||
"gitHead": "ec122e2b5144a5f8826d4d6544a5aae353d1c9c2" | ||
} |
@@ -5,2 +5,3 @@ var assert = require('chai').assert; | ||
var sinon = require('sinon'); | ||
var rewire = require('rewire'); | ||
@@ -183,4 +184,22 @@ var DaemonConfig = require('../../../lib/daemon_config'); | ||
}); | ||
it('handles invalid responses from the API gracefully', function() { | ||
var rewiredConnector = rewire('../../../lib/middleware/sampling/service_connector'); | ||
var assembleRules = rewiredConnector.__get__('assembleRules'); | ||
var res = assembleRules({}); | ||
assert.isArray(res); | ||
}); | ||
}); | ||
describe('fetchSamplingTargets', function() { | ||
it('handles invalid responses from the API gracefully', function() { | ||
var rewiredConnector = rewire('../../../lib/middleware/sampling/service_connector'); | ||
var assembleTargets = rewiredConnector.__get__('assembleTargets'); | ||
var res = assembleTargets({}); | ||
assert.deepEqual(res, {}); | ||
}); | ||
}); | ||
describe('DaemonConfig', function() { | ||
@@ -187,0 +206,0 @@ const DEFAULT_DAEMON_ADDRESS = '127.0.0.1'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
384034
9092