When performing math on empty series data, the following exception is thrown:
TypeError: Cannot read property '0' of undefined
at /var/node/apps/influxdb-timeshift-proxy/handlers.js:185:57
at Array.forEach (native)
at /var/node/apps/influxdb-timeshift-proxy/handlers.js:182:35
at Array.forEach (native)
at intercept (/var/node/apps/influxdb-timeshift-proxy/handlers.js:167:40)
at IncomingMessage.<anonymous> (/var/node/apps/influxdb-timeshift-proxy/node_modules/express-http-proxy/index.js:123:11)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:188:7)
at endReadableNT (_stream_readable.js:975:12)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
Came across this with some panels that don't have historical data for the desired time shift yet (or just no data that meets other conditions). For example the json variable in intercept() may look like:
{ results:
[ { statement_id: 0 },
{ statement_id: 1 },
{ statement_id: null, series: [Object] } ] }
Adding a conditional like the following to line 185 worked for me:
if (Array.isArray(json.results[idx].series)) json.results[idx].series[0].values = [];
Thanks!
When performing math on empty series data, the following exception is thrown:
Came across this with some panels that don't have historical data for the desired time shift yet (or just no data that meets other conditions). For example the
jsonvariable inintercept()may look like:Adding a conditional like the following to line 185 worked for me:
Thanks!