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

Crash when fetching last entry from Nightscout "TypeError: resp.data.pop is not a function" #154

Open
aleb opened this issue Jul 1, 2024 · 0 comments

Comments

@aleb
Copy link

aleb commented Jul 1, 2024

The Client.lastEntry() method in src/nightscout/apiv1.ts fails to handle the response from the Nightscout server.

A workaround is to specify ALL_DATA: "true" which would not call lastEntry but get insted all entries.

Not 100% sure when this happens. Maybe when the mongodb used by Nightscout is down, or when Nightscout did not receive entries in a long time.

Using the latest "latest" docker image:

$ docker pull timoschlueter/nightscout-librelink-up
Using default tag: latest
latest: Pulling from timoschlueter/nightscout-librelink-up
Digest: sha256:76e96bc901577a32a801eb3f31e491e1a074bab556345f244419148fee0bd2cc
Status: Image is up to date for timoschlueter/nightscout-librelink-up:latest
docker.io/timoschlueter/nightscout-librelink-up:latest
$ docker compose logs nightscout-librelinkup  -f
nightscout-librelinkup  | 
nightscout-librelinkup  | > [email protected] start-heroku
nightscout-librelinkup  | > node dist/index.js
nightscout-librelinkup  | 
nightscout-librelinkup  | [info]: Starting cron schedule: */1 * * * *
nightscout-librelinkup  | [info]: renew token
nightscout-librelinkup  | [info]: Logged in to LibreLink Up
nightscout-librelinkup  | [debug]: authenticatedHttpHeaders: {"User-Agent":"Mozilla/5.0 (iPhone; CPU OS 17_4.1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/17.4.1 Mobile/10A5355d Safari/8536.25","Content-Type":"application/json;charset=UTF-8","version":"4.10.0","product":"llu.ios","Authorization":"..."}
nightscout-librelinkup  | [info]: Found 1 LibreLink Up connection.
nightscout-librelinkup  | [info]: -> The following connection will be used: XXX (Patient-ID: XXX)
nightscout-librelinkup  | [debug]: authenticatedHttpHeaders: {"User-Agent":"Mozilla/5.0 (iPhone; CPU OS 17_4.1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/17.4.1 Mobile/10A5355d Safari/8536.25","Content-Type":"application/json;charset=UTF-8","version":"4.10.0","product":"llu.ios","Authorization":"XXX"}
nightscout-librelinkup  | /usr/src/app/dist/nightscout/apiv1.js:30
nightscout-librelinkup  |         return resp.data.pop();
nightscout-librelinkup  |                          ^
nightscout-librelinkup  | 
nightscout-librelinkup  | TypeError: resp.data.pop is not a function
nightscout-librelinkup  |     at Client.lastEntry (/usr/src/app/dist/nightscout/apiv1.js:30:26)
nightscout-librelinkup  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
nightscout-librelinkup  |     at async createFormattedMeasurements (/usr/src/app/dist/index.js:236:47)
nightscout-librelinkup  |     at async uploadToNightScout (/usr/src/app/dist/index.js:257:35)
nightscout-librelinkup  |     at async main (/usr/src/app/dist/index.js:129:5)
nightscout-librelinkup  | 
nightscout-librelinkup  | Node.js v20.15.0
nightscout-librelinkup exited with code 1
@aleb aleb changed the title Crash when fetching data "TypeError: resp.data.pop is not a function" Crash when fetching last entry from Nightscout "TypeError: resp.data.pop is not a function" Jul 9, 2024
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

1 participant