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

Error: failed to get last entry: undefined #165

Closed
albertogonsa opened this issue Oct 21, 2024 · 4 comments
Closed

Error: failed to get last entry: undefined #165

albertogonsa opened this issue Oct 21, 2024 · 4 comments

Comments

@albertogonsa
Copy link

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    | > [email protected] 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 [email protected]
nightscout-libre-link    | npm notice

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

@albertogonsa
Copy link
Author

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

Thank you.

@zkazsi
Copy link

zkazsi commented Nov 18, 2024

Hi @albertogonsa ,

can you please help and tell me what the issue (and solution) with the API token was?
I've tried using both the SHA1 hash of the token, as well as the token without hash, but I have the same errors

Thanks

@albertogonsa
Copy link
Author

Hi @zkazsi
My problem was the user created in the nightscout server.
I create an user with admin credentials and use this website to get the token https://codebeautify.org/sha1-hash-generator
I put the token in the configuration.yaml with hash.

@zkazsi
Copy link

zkazsi commented Nov 18, 2024

Thank you for the quick answer - I will try to create a new user - hopefully will solve it
EDIT: solved for me as well. It was a config problem

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

2 participants