nightscout / nightscout-connect

Single entry point for bridging cloud resources containing diabetes data to Nightscout.
GNU Affero General Public License v3.0
31 stars 31 forks source link

LibreLinkUp crashes when last_known is null #27

Open ACWalker opened 8 months ago

ACWalker commented 8 months ago

I have the following error when using the nightscout-connect plugin 0.0.12 on nightscout version 15.0.1:

 /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)

It seems the variable last_known is no longer used so the line lib/sources/librelinkup.js:124 can probably be removed.

I tried contributing myself but I don't have permissions to open a PR :(.

billyjbryant commented 5 months ago

I submitted PR #34 that fixes this issue. I tested this by installing nightscout-connect from my git repo in cgm-remote-monitor then building a container locally.

When deployed in place of my existing Nightscout stack, this fixes the issue with Libre Link up data not populating and the server crashing.