Describe the bug
When Nightscout is configured with CONNECT_SOURCE=linkup, the server crashes upon initial load of data from Libre Link Up. This is due to a bug in nightscout_connect which improperly handles data ingestion when there are no previous data points.
If last_known is null, the plugin crashes with the following error, causing a reboot loop on the container:
/opt/app/node_modules/nightscout-connect/lib/sources/librelinkup.js:124
var last_updated = last_known.entries;
^
TypeError: Cannot read properties of null (reading 'entries')
at Object.transformGlucose [as transformer] (/opt/app/node_modules/nightscout-connect/lib/sources/librelinkup.js:124:37)
at transformService (/opt/app/node_modules/nightscout-connect/lib/machines/fetch.js:14:37)
at Interpreter._exec (/opt/app/node_modules/xstate/lib/interpreter.js:269:63)
at Interpreter.exec (/opt/app/node_modules/xstate/lib/interpreter.js:1026:10)
at Interpreter.execute (/opt/app/node_modules/xstate/lib/interpreter.js:387:14)
at Interpreter.update (/opt/app/node_modules/xstate/lib/interpreter.js:415:12)
at /opt/app/node_modules/xstate/lib/interpreter.js:110:15
at Scheduler.process (/opt/app/node_modules/xstate/lib/scheduler.js:69:7)
at Scheduler.schedule (/opt/app/node_modules/xstate/lib/scheduler.js:48:10)
at Interpreter.send (/opt/app/node_modules/xstate/lib/interpreter.js:104:23)
This issue is fixed in nightscout_connect by adding in appropriate checks to ensure that direct reference to an undefined var are not performed and thus prevents the plugin from crashing.
This does not fix the crash in Nightscout as a result of the plugin crashing.
Describe the bug When Nightscout is configured with
CONNECT_SOURCE=linkup
, the server crashes upon initial load of data from Libre Link Up. This is due to a bug innightscout_connect
which improperly handles data ingestion when there are no previous data points.If last_known is null, the plugin crashes with the following error, causing a reboot loop on the container:
This issue is fixed in
nightscout_connect
by adding in appropriate checks to ensure that direct reference to an undefined var are not performed and thus prevents the plugin from crashing.This does not fix the crash in Nightscout as a result of the plugin crashing.
To Reproduce Steps to reproduce the behavior:
Expected behavior Connect should retrieve the patient data from LinkUp, process it then send it to Nightscout
Screenshots N/A
Your setup information
Additional context This bug was originally posted in https://github.com/nightscout/nightscout-connect/issues/27, cross posting it here because the failure in the connect plugin causes Nightscout to crash and restart, which is indicative of an error handling issue. The connect issue is fixed in https://github.com/nightscout/nightscout-connect/pull/34