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

TypeError: Cannot read properties of null (reading 'FactoryTimestamp') #30

Closed
dassystem opened this issue Mar 18, 2022 · 5 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@dassystem
Copy link

dassystem commented Mar 18, 2022

Hi, I have the following issue, right after starting the docker-container. It seems to be connected to nightscout and the librelink cloud correctly.

The error might occure because I have no recent blood glucose values in the libre cloud. (But I plan using it in the future, since I have to switch from libre2 to libre3).

nightscout-libre-link_1  | 
nightscout-libre-link_1  | > nightscout-librelink-up@1.5.0 start
nightscout-libre-link_1  | > node index.js
nightscout-libre-link_1  | 
nightscout-libre-link_1  | 2022-03-18T17:41:04.531Z [info]: Started
nightscout-libre-link_1  | 2022-03-18T17:42:07.692Z [info]: Logged in to LibreLink Up
nightscout-libre-link_1  | 2022-03-18T17:42:15.168Z [info]: Found 1 LibreLink Up connection.
nightscout-libre-link_1  | 2022-03-18T17:42:15.169Z [info]: -> The following connection will be used: XXX (Patient-ID: XXXXXX-XXXX-XXXXX-XXXX-XXXXXXXXXXXX)
nightscout-libre-link_1  | 2022-03-18T17:36:15.329Z [info]: Received blood glucose measurement                     
nightscout-libre-link_1  | /usr/src/app/index.js:186                                                               
nightscout-libre-link_1  |     const measurementDate = getUtcDateFromString(glucoseMeasurement.FactoryTimestamp);  
nightscout-libre-link_1  |                                                                     ^                   
nightscout-libre-link_1  |                                                                                         
nightscout-libre-link_1  | TypeError: Cannot read properties of null (reading 'FactoryTimestamp')                  
nightscout-libre-link_1  |     at uploadToNightscout (/usr/src/app/index.js:186:69)                                
nightscout-libre-link_1  |     at getGlucoseMeasurement (/usr/src/app/index.js:116:9)                              
nightscout-libre-link_1  |     at processTicksAndRejections (node:internal/process/task_queues:96:5)               
nightscout-libre-link_1  |                                                                                         
nightscout-libre-link_1  | Node.js v17.7.1
@timoschlueter
Copy link
Owner

hi @dassystem, can you make sure you have current measurements in the LibreLink Up app? i have not come across this issue myself yet. :(

@dassystem
Copy link
Author

dassystem commented Apr 7, 2022

Whether the application has fresh data from a client or not, the server should not crash. Not having data could have several reasons: A fresh setup, missing internet connection of the uploader, issues on the side of Abbots official servers… In these cases, certainly not the whole application should break.

Unfortunately I don't know javascript very well, but I assume that we need to check for null values when loading it to the variable in index.js line 186.

const measurementDate = getUtcDateFromString(glucoseMeasurement.FactoryTimestamp);

An additional try catch might solve it. Happy to test it.

@timoschlueter
Copy link
Owner

@dassystem is this still an issue with the latest version? I added a few improvements to the error handling.

@timoschlueter timoschlueter self-assigned this Jun 14, 2022
@timoschlueter timoschlueter added the bug Something isn't working label Jun 14, 2022
@dassystem
Copy link
Author

Hey @timoschlueter, thanks for the mention!

I'm now getting a error message in the log (which is correct!) and the application is not crashing anymore (which is even better!)

nightscout-libre-link    | 2022-06-14T13:11:48.104457492Z > nightscout-librelink-up@1.7.2 start
nightscout-libre-link    | 2022-06-14T13:11:48.104477066Z > node index.js
nightscout-libre-link    | 2022-06-14T13:20:00.425171582Z [info]: no authTicket.expires
nightscout-libre-link    | 2022-06-14T13:20:00.425530543Z [info]: renew token
nightscout-libre-link    | 2022-06-14T13:20:00.760973318Z [info]: Logged in to LibreLink Up
nightscout-libre-link    | 2022-06-14T13:20:00.954207820Z [info]: Found 1 LibreLink Up connection.
nightscout-libre-link    | 2022-06-14T13:20:00.955213701Z [info]: -> The following connection will be used: <MY-NAME> (Patient-ID: <MY-UUID>)
nightscout-libre-link    | 2022-06-14T13:20:01.130118050Z [info]: Received blood glucose measurement items
nightscout-libre-link    | 2022-06-14T13:20:01.132070664Z [error]: Error getting glucose measurements Cannot read properties of null (reading 'FactoryTimestamp')

So at least this unhappy-path is working as expected and this bug issue can be closed. Thank you!

@timoschlueter
Copy link
Owner

awesome! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants