diff --git a/packages/unleash-api/lib/client-metrics-service.js b/packages/unleash-api/lib/client-metrics-service.js index 17eba77d8e..c0ed79f1a3 100644 --- a/packages/unleash-api/lib/client-metrics-service.js +++ b/packages/unleash-api/lib/client-metrics-service.js @@ -1,4 +1,5 @@ 'use strict'; + const POLL_INTERVAL = 10000; module.exports = class UnleashClientMetrics { @@ -14,7 +15,9 @@ module.exports = class UnleashClientMetrics { addMetrics (metrics) { metrics.forEach(m => this.metrics.push(m)); - this.highestIdSeen = this.metrics[this.metrics.length - 1].id; + if (this.metrics && this.metrics.length > 0) { + this.highestIdSeen = this.metrics[this.metrics.length - 1].id; + } } startPoller () {