timoschlueter / nightscout-librelink-up

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

Error: failed to get last entry: undefined #165

Closed albertogonsa closed 2 hours ago

albertogonsa commented 3 hours ago

Hi. I have used docker compose to run the code in a linux vm where I have other docker images running. I create a directory named nightscout-librelink-up and inside I've created the docker-compose.yml with the info.

When I execute "docker-compose up" in the directory I get this:

Error: failed to get last entry: undefined

Creating nightscout-libre-link ... done
Attaching to nightscout-libre-link
nightscout-libre-link    |
nightscout-libre-link    | > nightscout-librelink-up@2.7.0 start-heroku
nightscout-libre-link    | > node dist/index.js
nightscout-libre-link    |
nightscout-libre-link    | [info]: Starting cron schedule: */5 * * * *
nightscout-libre-link    | [info]: renew token
nightscout-libre-link    | [info]: Logged in to LibreLink Up
nightscout-libre-link    | [info]: Found 1 LibreLink Up connection.
nightscout-libre-link    | [info]: -> The following connection will be used: Alberto González Sánchez (Patient-ID: ******)
nightscout-libre-link    | [error]: {"status":401,"message":"Unauthorized","description":"Invalid/Missing"}
nightscout-libre-link    | /usr/src/app/dist/nightscout/apiv1.js:25
nightscout-libre-link    |             throw Error(`failed to get last entry: ${resp.statusText}`);
nightscout-libre-link    |                   ^
nightscout-libre-link    |
nightscout-libre-link    | Error: failed to get last entry: undefined
nightscout-libre-link    |     at Client.lastEntry (/usr/src/app/dist/nightscout/apiv1.js:25:19)
nightscout-libre-link    |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
nightscout-libre-link    |     at async createFormattedMeasurements (/usr/src/app/dist/index.js:236:47)
nightscout-libre-link    |     at async uploadToNightScout (/usr/src/app/dist/index.js:257:35)
nightscout-libre-link    |     at async main (/usr/src/app/dist/index.js:129:5)
nightscout-libre-link    |
nightscout-libre-link    | Node.js v20.15.0
nightscout-libre-link    | npm notice
nightscout-libre-link    | npm notice New minor version of npm available! 10.7.0 -> 10.9.0
nightscout-libre-link    | npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.9.0
nightscout-libre-link    | npm notice To update run: npm install -g npm@10.9.0
nightscout-libre-link    | npm notice

What that it means? What I am doing wrong? Thank you.

albertogonsa commented 2 hours ago

I've solved it. It was a problem with the API token of nightscout. Running perfectly using docker-compose.

Thank you.