timoschlueter / nightscout-librelink-up

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

OpenSSL Error on Upload Attempt #112

Closed CablingOptional closed 9 months ago

CablingOptional commented 9 months ago

Hello -

Has anyone ever seen this error?

nightscout-libre-link | [info]: Trying to upload 142 glucose measurement items to Nightscout nightscout-libre-link | [error]: write EPROTO C0C745C8107F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:355: nightscout-libre-link | nightscout-libre-link | [error]: Upload to NightScout failed nightscout-libre-link | [info]: Found 1 LibreLink Up connection. nightscout-libre-link | [info]: -> The following connection will be used: [my name] (Patient-ID: [super long number]) nightscout-libre-link | [error]: write EPROTO C0C745C8107F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:355: nightscout-libre-link |

CablingOptional commented 9 months ago

I'm launching all four containers (nightscout, traefik, mongo, and nightscout-libre-link) via the same docker-compose.yml file, and all four start successfully. I can log in to Nightscout without issue, and the logs show that libre-link is at least able to connect to LibreLinkUp...but always dealing with various issues re: libre-link writing to nightscout.

Just did a docker-compose pull and got the newest version of some of the containers, but issue remains.

timoschlueter commented 9 months ago

Could you post your docker-compose.yml file here? Maybe I can see what's wrong with your setup.

Just make sure to delete all sensitive information first (patient id, tokens, passwords).

CablingOptional commented 9 months ago

` [REDACTED]:~$ more docker-compose.yml version: '3.9'

x-logging: &default-logging options: max-size: '10m' max-file: '5' driver: json-file

services: nightscout: image: nightscout/cgm-remote-monitor:latest environment:

-----------------------------------------------------------------------------------------------

Here are your Nightscout variables:

Respect the format VARIABLE: value (with a space after :)

#

Mandatory information

  TZ: US
  API_SECRET: [REDACTED]
  ENABLE: careportal sage iage cage iob cob basal upbat devicestatus dbsize cors
  SHOW_PLUGINS: careportal sage iob cob dbsize cors ar2
  DISPLAY_UNITS: mg/dl

  #BRIDGE_USER_NAME: username
  #BRIDGE_PASSWORD: password
  #BRIDGE_SERVER: EU

  AUTH_DEFAULT_ROLES: readable
  NIGHT_MODE: off
  THEME: colors
  TIME_FORMAT: 24
  SCALE_Y: linear
  AR2_CONE_FACTOR: 0
  SHOW_RAWBG: always
  DBSIZE_MAX: DISK_SIZE
  #BASAL_RENDER: default
  BOLUS_RENDER_FORMAT_SMALL: minimal
  BOLUS_RENDER_OVER: 1

  BG_LOW: 60
  BG_TARGET_BOTTOM: 70
  BG_TARGET_TOP: 180
  BG_HIGH: 200
  ALARM_TYPES: simple
  ALARM_HIGH: on
  ALARM_LOW: on
  ALARM_URGENT_HIGH: on
  ALARM_URGENT_LOW: on
  ALARM_TIMEAGO_URGENT: on
  ALARM_TIMEAGO_URGENT_MINS: 30
  ALARM_TIMEAGO_WARN: on
  ALARM_TIMEAGO_WARN_MINS: 15

  DEVICESTATUS_ADVANCED: true
  SAGE_INFO: 336
  SAGE_URGENT: 348
  SAGE_WARN: 342
  #SHOW_FORECAST:
  #PUMP_FIELDS: reservoir battery clock status
  #PUMP_RETRO_FIELDS: battery reservoir clock status
  #PUMP_URGENT_BATT: 26
  #PUMP_WARN_BATT: 51
  #IAGE_INFO: 68
  #IAGE_URGENT: 79
  #IAGE_WARN: 72
  #PUMP_ENABLE_ALERTS: true
  #PUMP_URGENT_BATT_U: 30
  #PUMP_URGENT_BATT_V: 1.25
  #PUMP_URGENT_RES: 10
  #PUMP_URGENT_CLOCK: 30
  #LOOP_ENABLE_ALERTS: true
  #LOOP_WARN: 20
  #LOOP_URGENT: 60

-----------------------------------------------------------------------------------------------

Do not change anything below unless you know what you are doing

-----------------------------------------------------------------------------------------------

  INSECURE_USE_HTTP: false
  MONGO_CONNECTION: mongodb://mongo:27017/Nightscout
ports:
  - "1337:1337"
depends_on:
  - mongo
labels:
  - 'traefik.enable=true'
  # Change the below Host from `localhost` to be the web address where Nightscout is running.
  # Also change the email address in the `traefik` service below.
  - 'traefik.http.routers.nightscout.rule=Host(`[REDACTED]`)'
  - 'traefik.http.routers.nightscout.entrypoints=websecure'
  - 'traefik.http.routers.nightscout.tls.certresolver=le'
volumes:
  - /nightscout/docker:/var/opt/ssl/:ro
restart: unless-stopped

mongo:

Note you can also use mongo:5

image: mongo:4.4
container_name: mongo
volumes:
  - ./data:/data/db

Enable only of you want external access, but then you should modify mongo login and passord

#ports:
  #- "27017:27017"
logging: *default-logging
restart: unless-stopped

traefik: image: traefik:latest container_name: 'traefik' command:

timoschlueter commented 9 months ago

From first glance I think the problem is that you set the following option:

_NIGHTSCOUT_DISABLEHTTPS: "false"

Since you are using docker internal networking, this option should be set to "true".

Please try again with this setting :)

CablingOptional commented 9 months ago

When I change that to true and restart all containers, I get the same log messages from nightscout-librelink-up

When I also change INSECURE_USE_HTTP:, under the nightscout section of the docker-compose.yml, from false to true, I then get the messages below. I suspect this additional change I made was not proper, as I definitely do want my externally-reachable Nightscout site to be https.

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: [REDACTED] (Patient-ID: [REDACTED]) nightscout-libre-link | [error]: {"status":401,"message":"Unauthorized","description":"Invalid/Missing"} nightscout-libre-link | [info]: Trying to upload 142 glucose measurement items to Nightscout nightscout-libre-link | [error]: {"status":401,"message":"Unauthorized","description":"Invalid/Missing"} nightscout-libre-link | [error]: Upload to NightScout failed

CablingOptional commented 9 months ago

It's finally working!

Fix was to change INSECURE_USE_HTTP:, under the nightscout section of the docker-compose.yml, to true in addition to setting NIGHTSCOUT_DISABLE_HTTPS: to true under the nightscout-librelink-up section (as timo mentioned above).

The final error was just an invalid hash of my API token.

Thanks Timo for the help and for making an awesome tool!

timoschlueter commented 9 months ago

awesome! glad that it works for you now :)