WebThingsIO / gateway

WebThings Gateway
http://webthings.io/gateway
Mozilla Public License 2.0
2.61k stars 333 forks source link

Cannot start container, nodejs error #3109

Closed PSLLSP closed 9 months ago

PSLLSP commented 10 months ago

Fresh install of webthings. I have zero experience with this software... Looks like some problem when DB is created...

Container installed from dockerhub:

$ docker pull webthingsio/gateway
$ docker images | grep webthingsio
webthingsio/gateway             latest    27dfd8ef7bac   8 months ago    1.04GB
$ docker ps -a | grep webthingsio
e51cfaf17e42   webthingsio/gateway:latest             "/init.sh"               54 seconds ago   Exited (1) 52 seconds ago             webthings-gateway

The issue:

$ docker logs e51cfaf17e42
+ WEBTHINGS_HOME=/home/node/.webthings
+ args=
+ start_task=run-only
+ is_container
+ '[' -f /.dockerenv ']'
+ return 0
++ node --version
++ egrep -o '[0-9]+'
++ head -n1
+ _node_version=12
+ [[ ! -f /home/node/.webthings/.node_version ]]
+ cd /home/node/webthings/gateway
+ mkdir -p /home/node/.webthings/config
+ ./tools/update-addons.sh
Creating database: /home/node/.webthings/config/db.sqlite3
/home/node/webthings/gateway/build/models/things.js:377
addon_manager_1.default.on(Constants.THING_ADDED, (thing) => {
                        ^

TypeError: Cannot read property 'on' of undefined
    at Object.<anonymous> (/home/node/webthings/gateway/build/models/things.js:377:25)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/node/webthings/gateway/build/models/actions.js:40:34)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

DB is empty:

$ sqlite3 ~/.webthings/config/db.sqlite3 .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
COMMIT;
$ docker version
Client:
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.1
 Git commit:        20.10.21-0ubuntu1~18.04.3
 Built:             Thu Apr 27 05:50:21 2023
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.1
  Git commit:       20.10.21-0ubuntu1~18.04.3
  Built:            Thu Apr 27 05:36:22 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.12-0ubuntu1~18.04.1
  GitCommit:        
 runc:
  Version:          1.1.4-0ubuntu1~18.04.2
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        
benfrancis commented 9 months ago

Thank you for reporting, this appears to be a duplicate of #3043