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

Crashing when attempting to sync with Glooko #23

Open devonestes opened 10 months ago

devonestes commented 10 months ago

Hey y'all,

So I've got this basically set up it seems, but there is an error when trying to sync with Glooko. It's authenticating correctly from the logs I've seen, but then I see this error which leads to a crash:

2023-08-26T09:35:04Z app[1781975b54e178] fra [info]/opt/app/node_modules/nightscout-connect/lib/sources/glooko/index.js:85
2023-08-26T09:35:04Z app[1781975b54e178] fra [info]      var last_mills = Math.max(two_days_ago, last_known.entries ? last_known.entries.getTime( ) : two_days_ago);
2023-08-26T09:35:04Z app[1781975b54e178] fra [info]                                                         ^
2023-08-26T09:35:04Z app[1781975b54e178] fra [info]TypeError: Cannot read properties of null (reading 'entries')
2023-08-26T09:35:04Z app[1781975b54e178] fra [info]    at Object.dataFromSesssion (/opt/app/node_modules/nightscout-connect/lib/sources/glooko/index.js:85:58)
2023-08-26T09:35:04Z app[1781975b54e178] fra [info]    at dataFetchService (/opt/app/node_modules/nightscout-connect/lib/machines/fetch.js:8:19)
2023-08-26T09:35:04Z app[1781975b54e178] fra [info]    at Interpreter._exec (/opt/app/node_modules/xstate/lib/interpreter.js:269:63)
2023-08-26T09:35:04Z app[1781975b54e178] fra [info]    at Interpreter.exec (/opt/app/node_modules/xstate/lib/interpreter.js:1026:10)
2023-08-26T09:35:04Z app[1781975b54e178] fra [info]    at Interpreter.execute (/opt/app/node_modules/xstate/lib/interpreter.js:387:14)
2023-08-26T09:35:04Z app[1781975b54e178] fra [info]    at Interpreter.update (/opt/app/node_modules/xstate/lib/interpreter.js:415:12)
2023-08-26T09:35:04Z app[1781975b54e178] fra [info]    at /opt/app/node_modules/xstate/lib/interpreter.js:110:15
2023-08-26T09:35:04Z app[1781975b54e178] fra [info]    at Scheduler.process (/opt/app/node_modules/xstate/lib/scheduler.js:69:7)
2023-08-26T09:35:04Z app[1781975b54e178] fra [info]    at Scheduler.schedule (/opt/app/node_modules/xstate/lib/scheduler.js:48:10)
2023-08-26T09:35:04Z app[1781975b54e178] fra [info]    at Interpreter.send (/opt/app/node_modules/xstate/lib/interpreter.js:104:23)

Looks like somehow last_known is being passed in as null? Any idea why this might happen or how I can resolve it? Maybe we just need to have an explicit if last_entries === null in there to handle this?

Kaiz3n-M commented 4 months ago

Having the same issue, any update?