Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Nightscout crashes when setting up connect_source_libre for the first time. #8209

Open
billyjbryant opened this issue Jan 13, 2024 · 1 comment

Comments

@billyjbryant
Copy link

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.

To Reproduce
Steps to reproduce the behavior:

  1. Configure the environment variables for Libre Link Up as directed here: https://github.com/nightscout/cgm-remote-monitor?tab=readme-ov-file#libre-link-up
  2. Start the Nightscout server
  3. Monitor server logs
  4. Upon retrieving data from Link Up the plugin crashes

Expected behavior
Connect should retrieve the patient data from LinkUp, process it then send it to Nightscout

Screenshots
N/A

Your setup information

  • Nightscout 15.0.2
  • Freestyle Libre 3 + Libre Link up

Additional context
This bug was originally posted in nightscout/nightscout-connect#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 nightscout/nightscout-connect#34

@billyjbryant
Copy link
Author

Is anyone going to look at this issue and the associated fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@billyjbryant and others