eufy-ha-mqtt-bridge icon indicating copy to clipboard operation
eufy-ha-mqtt-bridge copied to clipboard

Error when starting v0.2.19

Open wimb0 opened this issue 3 years ago • 10 comments

After updating to v0.2.19 from v0.2.17 in Docker, the bridge does not start anymore. Reverting to v0.2.17 solves the issue.

Running via DockerCompose on Ubuntu 18.04 on a Dell Optiplex 3060 Micro. Using a Wireless 2K Doorbell, Eufycam 2 Pro, Homebase 2 and 2K Indoor Camera.

Docker Compose Config:

# Eufy Bridge
  eufy-bridge:
    container_name: eufy-bridge
    image: matijse/eufy-ha-mqtt-bridge
#    image: matijse/eufy-ha-mqtt-bridge:0.2.17
    restart: unless-stopped
    volumes:
      - /mnt/data/docker/eufy-bridge:/app/data

Config.yml:

eufy:
  username: "[email protected]"
  password: "password"
mqtt:
  url: "mqtt://mosquitto:1883"
  username: "username"
  password: "password"
  keepalive: 60
home_assistant:
  off_delay: 5

Logs from container:

(process:18): VIPS-WARNING **: 07:51:19.803: unable to load "/usr/lib/vips-modules-8.11/vips-heif.so" -- Error relocating /usr/lib/libheif.so.1: de265_get_image_full_range_flag: symbol not found
(node:18) UnhandledPromiseRejectionWarning: Error: SQLITE_READONLY: attempt to write a readonly database
(Use `node --trace-warnings ...` to show where the warning was created)
(node:18) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `NODE_ENV=production node --unhandled-rejections=strict index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2021-06-24T07_51_21_840Z-debug.log

> [email protected] start /app
> NODE_ENV=production node --unhandled-rejections=strict index.js


(process:19): VIPS-WARNING **: 07:51:26.270: unable to load "/usr/lib/vips-modules-8.11/vips-heif.so" -- Error relocating /usr/lib/libheif.so.1: de265_get_image_full_range_flag: symbol not found
(node:19) UnhandledPromiseRejectionWarning: Error: SQLITE_READONLY: attempt to write a readonly database
(Use `node --trace-warnings ...` to show where the warning was created)
(node:19) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `NODE_ENV=production node --unhandled-rejections=strict index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2021-06-24T07_51_28_250Z-debug.log

wimb0 avatar Jun 24 '21 07:06 wimb0

Same issue with 0.2.19 / latest container

lolouk44 avatar Jun 24 '21 14:06 lolouk44

Same issue with latest container

thomclae33 avatar Jun 27 '21 15:06 thomclae33

As this will or already happend to my clone/add-on of this I spent a few minutes.

The problem is based somewhere on the liblivps stuff and the node package sharp. Both not my main business, but i can provide some quick workaround until somewone is available that is smarter than me:

Overwrite the entrypoint

By installing sharp again, but without the system dependency to libvips is runs fine.

cat docker-compose.yml
services:
  eufy-bridge:
    container_name: eufy-bridge
    image: matijse/eufy-ha-mqtt-bridge
    volumes:
      - /Users/winterstein/tmp/eufy-mqtt:/app/data
    entrypoint: ["/bin/sh", "-c" , "SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install sharp && npm run start"]

Documentation for reference:
https://sharp.pixelplumbing.com/install

MaxWinterstein avatar Jun 27 '21 17:06 MaxWinterstein

The logs in the first post look like it works (the VIPS warning I get as well), the real issue there seems to be:

(node:18) UnhandledPromiseRejectionWarning: Error: SQLITE_READONLY: attempt to write a readonly database

Which is probably due to changes in the Docker file, where the root user couldn't be used to install vips/sharp. So this probably can be fixed by either removing the SQLITE file (in the data directory), or giving it wider permissions (chmod 777 path/to/database.sqlite)


As for the vips/sharp issues, I also don't really understand what is happening on all architectures etc, so I am thinking about removing the image validation part as a whole and just downloading all images twice, 1 second apart or something... Would make everything a lot simpler.

matijse avatar Jul 05 '21 09:07 matijse

I still think we should take care of the VIPS warning. Using mixed library versions is always a bad idea. But, still unsure why you manually install vips-dev. Using your same Dockerfile without the line works fine for me:

diff --git a/Dockerfile b/Dockerfile
index 65d4c05..23e2d0d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,7 +3,6 @@ FROM node:14-alpine
 RUN apk add --no-cache --virtual .build-dependencies \
        && apk --no-cache add libpng librsvg libgsf giflib libjpeg-turbo musl make g++ musl-utils libssl1.1 libcrypto1.1 \
        && apk add libimagequant-dev fftw-dev build-base --update-cache  --repository https://alpine.global.ssl.fastly.net/alpine/edge/testing/  --repository https://alpine.global.ssl.fastly.net/alpine/edge/main \
-       && apk add vips-dev --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \
        && apk --no-cache add --virtual .build-dependencies g++ make python curl tar gtk-doc gobject-introspection expat-dev glib-dev libpng-dev libjpeg-turbo-dev giflib-dev librsvg-dev
 #      && su node \
 #      && npm install sharp@${SHARP_VERSION} --g --production --unsafe-perm \

MaxWinterstein avatar Jul 06 '21 22:07 MaxWinterstein

Hmm I had a lot of issues getting it to work on all platforms... I might try again with that change, but ideally I want to remove the dependency (and also sqlite) as it would simplify things and make the builds faster and less error prone.... If I just re-download all images after a second, the same functionality would be achieved I guess...

matijse avatar Jul 07 '21 09:07 matijse

Tried to investigate a little bit on this.

It should also be some less pain when using another distro than alpine, wo we can rely on glic instead of musl. Been trying to switch at my Dockerfile as it is broken - like you told :(

MaxWinterstein avatar Jul 07 '21 09:07 MaxWinterstein

@matijse we have this conversation across multiple issues now :/

I did some testing with debian and ubuntu. I was not able to find some good solution that fits for everyone. Back to the one with warning, that worked at least...

MaxWinterstein avatar Jul 08 '21 09:07 MaxWinterstein

I just got a Eufy doorbell and tried setting this up, but I'm getting the same error on the latest version. It briefly connects to MQTT and Home Assistant, then changes to unavailable.

It appears that 0.2.17 works though. It updates "Last Event" with a picture, doorbell pressed, and battery percent. It doesn't update motion detection or person detection.

Edit: Now 0.2.17 isn't working.

scottocs11 avatar Jul 11 '21 20:07 scottocs11

I reverted to 0.2.17 and the container will now stay running, and show the last event, and battery percentage.

spencerbutler avatar Jul 15 '21 20:07 spencerbutler