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

Upload to NightScout failed #72

Closed akitamostodos closed 1 year ago

akitamostodos commented 1 year ago

Hello, Sute I am doing something bad, but I dont know... If someone can help me.....

yml of the nightscout-librelink-up is:

version: '3.3'

version: '3.3'

services: nightscout-libre-link: image: timoschlueter/nightscout-librelink-up container_name: nightscout-libre-link environment: LINK_UP_USERNAME: "USERNAME_LIBRELINK_UP" LINK_UP_PASSWORD: "PASSWORD_LIBRELINK_UP" NIGHTSCOUT_DISABLE_HTTPS: "true" LINK_UP_TIME_INTERVAL: "1" LINK_UP_REGION: "EU" NIGHTSCOUT_URL: "192.168.0.116" -> LOCAL IP NIGHTSCOUT_API_TOKEN: "123456789123456789" LOG_LEVEL: "info"

############ ############ ############ ############

the yml of the /nightscout-docker from the web: nightscout-docker

broker: image: 'prologic/mosquitto:latest' ports:

Uncomment if you want to expose the MongoDB port directly

If you're using the API interface (highly recommended) then you can

safely leave this commented out

ports:

nightscout: image: 'nightscout/cgm-remote-monitor-development:latest' environment:

############ ############ ############

The log is:

[info]: Starting cron schedule: /5 * [info]: no authTicket.expires [info]: renew token [info]: Logged in to LibreLink Up [info]: Found 1 LibreLink Up connection. [info]: -> The following connection will be used: NAMEXXXx (Patient-ID: XXXXXXXX) [error]: self-signed certificate [info]: Trying to upload 44 glucose measurement items to Nightscout [error]: self-signed certificate [error]: Upload to NightScout failed

timoschlueter commented 1 year ago

Since you are using docker internal communication, you have to disable HTTPS on your Nightscout container.

Just set the environment variable INSECURE_USE_HTTP to true. This will make Nightscout listen for unencrypted traffic, which the LibreLink Up container needs in your configuration.

akitamostodos commented 1 year ago

Yes, now other error:

[error]: {"message":"Not authorized"} [error]: Upload to NightScout failed

I dont know why, I use the api of admin, and now I have created a device I try wit the new api and same error :( frustrating for me:(

Lot of thanks.

timoschlueter commented 1 year ago

Have you created a new subject within Nightscouts Admin Tools? You also have to set the “admin” role to the subject and then use the generated token for the Uploader.

akitamostodos commented 1 year ago

Yes i did it. And if I put on the web:

http://0.0.0.0:1337/api/v2/authorization/request/device2-67e535026826088a

RETURN:

token "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NUb2tlbiI6ImRldmljZTItNjdlNTM1MDI2ODI2MDg4YSIsImlhdCI6MTY2NjAxMzg3OCwiZXhwIjoxNjY2MDQyNjc4fQ.sTzMS9WEFD8mq5RHNdqZPkE8KN29e4LBveTnm_OoAs8" sub "device2" permissionGroups
0
0 "*" 1 [] iat 1666013878 exp 1666042678

But on the uploader dosnt work

emmatovar27 commented 1 year ago

I have a similar issue with a local connection!

I'm using docker to handle everything.

image

I still got the same error.

image

I have tried:

timoschlueter commented 1 year ago

Just to make sure there is no misunderstanding: If you try to connect the uploader to a local Nightscout instance on the same machine via localhost there are two settings you have to set via environment variables:


Nightscout Docker Container: INSECURE_USE_HTTP=true

LibreLink Up Docker Container: NIGHTSCOUT_DISABLE_HTTPS=true


Can you please check again that both containers are configured correctly? The settings above disable the HTTPS-requirement on Nightscout itself and additionally makes the uploader access Nightscout through HTTP.

emmatovar27 commented 1 year ago

Yes! both of the variables are set up correctly.

image

image

Do you think the reason for that is that there are no previous entries? image

Thanks again!

emmatovar27 commented 1 year ago

Hey, I fixed it! :)

I have to change the name from localhost to the container name (nightscout).

image

image

Thanks again for this tool! :) I will extract those values to compare them with Dexcom G6.

akitamostodos commented 1 year ago

I have a similar issue with a local connection!

I'm using docker to handle everything.

image

I still got the same error.

image

I have tried:

  • Pass the token or the SHA1 Hash
  • INSECURE_USE_HTTP = true

OOOKKKK localhost or ip AND PORT!!!! I write the port and works! thanks.

pettermork commented 1 year ago

I too have this issue but changing nightscout url doesn't seem to help (mine is also called nightscout)

Nightscout on Synology via Docker. INSECURE_USE_HTTP is set to false.

dockerfile:

Skärmavbild 2022-12-05 kl  22 28 52

and log output:

Skärmavbild 2022-12-05 kl  22 35 04

Grateful for any input.

timoschlueter commented 1 year ago

@pettermork in your case, the librelink-up container and the nightscout container don't seem to be able to reach each other. This may be the case if both docker containers are not connected to the same docker network. Can you tell us where you are hosting the setup and maybe post the entire docker-compose.yml?

pettermork commented 1 year ago

@timoschlueter I'm self hosting on my Synology using Portainer to manage my containers. (Btw, If anyone else interested to host their own nightscout but is hesitant because it seems like a bit too much there's an excellent walkthrough here. I know very little about this stuff, which is why I'm here asking questions, but I was able to get it up and running. )

anyhow, my docker-compose.yml looks like this

version: "2"

networks: app-tier: driver: bridge

services: mongodb: restart: always image: "bitnami/mongodb:4.4.2" volumes:

pettermork commented 1 year ago

Ok, found the problem. Turned out as so often is the case it was sitting two feet in front of the screen... Despite it being stated several times in this very thread I had INSECURE_USE_HTTP set to false 🤦‍♂️. Anyway, it's working now and I want to thank @timoschlueter for making this.