timoschlueter / nightscout-librelink-up

Script written in TypeScript that uploads CGM readings from LibreLink Up to Nightscout.
MIT License
192 stars 246 forks source link

Error fetching the last entry date - TypeError: response.data.pop is not a function #88

Closed pmalmirae closed 1 year ago

pmalmirae commented 1 year ago

I have successfully run the script for a few days, but now it stopped working. The log has an error while fetching the date information on the last entry:

2023-01-24T03:03:50.799022396Z stdout F [info]: Starting cron schedule: */1 * * * *
2023-01-24T03:04:00.916361167Z stdout F [info]: renew token
2023-01-24T03:04:02.395944038Z stdout F [info]: Logged in to LibreLink Up
2023-01-24T03:04:02.566096874Z stdout F [info]: -> The following connection will be used: First Last (Patient-ID: sssss-ssss-ssss-ssss-ssssssssssss)
2023-01-24T03:04:02.795578284Z stderr F /usr/src/app/src/index.ts:277
2023-01-24T03:04:02.795625673Z stderr F     return new Date(response.data.pop().dateString);
2023-01-24T03:04:02.795632456Z stderr F                                   ^
2023-01-24T03:04:02.799240445Z stderr F TypeError: response.data.pop is not a function
2023-01-24T03:04:02.799269675Z stderr F     at lastEntryDate (/usr/src/app/src/index.ts:277:35)
2023-01-24T03:04:02.799274363Z stderr F     at processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-01-24T03:04:02.799277397Z stderr F     at async createFormattedMeasurements (/usr/src/app/src/index.ts:285:23)
2023-01-24T03:04:02.799280563Z stderr F     at async uploadToNightScout (/usr/src/app/src/index.ts:317:44)
2023-01-24T03:04:02.799283531Z stderr F     at async main (/usr/src/app/src/index.ts:152:5)
2023-01-24T03:04:03.797987551Z stderr F npm notice
2023-01-24T03:04:03.797667648Z stderr F npm notice Run `npm install -g npm@9.3.1` to update!
2023-01-24T03:04:03.797664875Z stderr F npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.3.1>;
2023-01-24T03:04:03.797660378Z stderr F npm notice New major version of npm available! 8.19.2 -> 9.3.1
2023-01-24T03:04:03.797618615Z stderr F npm notice

Libre LinkUp app still shows the data correctly, so. apparently the Libre side is working.

StuGotz commented 1 year ago

I setup LibreLink Up and a self-hosted docker instance of nightscout yesterday. I'm also getting the same error in my logs trying to use librelink-up. I attempted to use a cloudflare zero trust tunnel to my self-hosted nightscout container though. Doing this requires pin verification before access is granted to the publically facing domain. I was able to successfully access my nightscout server using the public URL by accessing the console of the librelink-up container, installing lynx, opening my public facing URL in lynx and completing the pin verification in the text browser.

Is this error due to the cloudflare verification? I'm new to using these tunnels, but it doesn't look like this pin verification can be disabled. If that's the case can support be added to support cloudflare zero trust tunnels?

StuGotz commented 1 year ago

I setup LibreLink Up and a self-hosted docker instance of nightscout yesterday. I'm also getting the same error in my logs trying to use librelink-up. I attempted to use a cloudflare zero trust tunnel to my self-hosted nightscout container though. Doing this requires pin verification before access is granted to the publically facing domain. I was able to successfully access my nightscout server using the public URL by accessing the console of the librelink-up container, installing lynx, opening my public facing URL in lynx and completing the pin verification in the text browser.

Is this error due to the cloudflare verification? I'm new to using these tunnels, but it doesn't look like this pin verification can be disabled. If that's the case can support be added to support cloudflare zero trust tunnels?

I found a way to disable the cloudflare pin verification and this error is now gone from the logs :)

timoschlueter commented 1 year ago

Adding support for single providers is out of scope for this project. I think your solution is the way to go. We try our best to offer simple deployment mechanisms but other than that we should rely on discussions like yours for users having problems in the future. Thank you for sharing this! :)