**Resolved** Installation Issue with openHAB Cloud on Centos 7

  • Platform information:

    • Hardware: AWS t2.medium (2 core 8g)

    • OS: CentOS-7-2111-20220330_2.x86_64-d9a3032a-921c-4c6d-b150-bde168105e42

    • Java Runtime Environment:
      node -v
      v14.19.3
      npm -v
      6.14.17

    • openHAB version: openHab Cloud 1.0.16

  • Issue of the topic: Issue with running node app.js, hangs with no actionable error.

  • Please post configurations (if applicable):
    Happy to post any relevant configs.

  • If logs were generated please post these here using code fences:
    Output of sudo DEBUG=* node app.js:

winston:create-logger: Define prototype method for "error"
winston:create-logger: Define prototype method for "warn"
winston:create-logger: Define prototype method for "info"
winston:create-logger: Define prototype method for "http"
winston:create-logger: Define prototype method for "verbose"
winston:create-logger: Define prototype method for "debug"
winston:create-logger: Define prototype method for "silly"
winston:create-logger: Define prototype method for "error"
winston:create-logger: Define prototype method for "warn"
winston:create-logger: Define prototype method for "info"
winston:create-logger: Define prototype method for "verbose"
winston:create-logger: Define prototype method for "debug"
winston:create-logger: Define prototype method for "silly"
winston:create-logger: Define prototype method for "audit"
  oauth2orize register request parser code request +0ms
  oauth2orize register response handler code response +1ms
  oauth2orize register error handler code errorHandler +0ms
  oauth2orize register exchanger authorization_code authorization_code +0ms
{}
(node:28180) Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)

Netstat -tulpn never reveals a listener on port 3000, as the application never gets that far, so this is not an issue of network access.

A clue is the braces; related searches show this may have something to do with APN setup? The initial error looks more like:

{“errno”:-2,“syscall”:“open”,“code”:“ENOENT”,“path”:“certs/aps/AuthKey.p8”}

but per other articles I’ve seen (Setup your own openhab-cloud (myopenhab) server/instance - #229 by e36Alex) there doesn’t seem to be a known fix, and I’ve tried both removing the configuration object from config.json and putting a dummy certs/aps/AuthKey.p8 in place, both of which result in the empty brace in the logs.

Has anyone made progress on this since the post I linked, by any chance?

Is anyone maintaining this repo anymore? No release in over a year. Would it be a problem if a few of us stop by and try to freshen it up a bit?
Thanks in advance!

I did a setup in Oct 2021. In my config I remove the apn object from the json config file.
Can you show your config.json file ? Take care to hide passwords / email / domain.

{
    "system": {
      "host": "cloud.newdomain.com",
      "port": "443",
      "protocol": "https",
      "logger" : {
        "dir": "./logs",
        "maxFiles" : "7d",
        "level" : "debug",
        "morganOption" : null
      },
      "subDomainCookies": false,
      "muteNotifications": false
    },
    "express":{
      "key" : "some express key"
    },
    "apn" : {
      "team": "PB1234567",
      "keyId": "BLABLA1",
      "defaultTopic": "es.spaphone.openhab",
      "signingKey": "certs/aps/AuthKey.p8"
    },
    "gcm" : {
      "jid": "something@gcm.googleapis.com",
      "password": "password"
    },
    "ifttt" : {
      "iftttChannelKey" : "<ouriftttapikey>",
      "iftttTestToken" : "token"
    },
    "mail": {
      "host" : "smtp-relay.gmail.com",
      "port" : 465,
      "user" : "user@newdomain.com",
      "pass" : "<agreatpassword>"
    },
    "mongodb": {
        "hosts": ["127.0.0.1"],
        "db": "openhab",
        "user": "<thecoolestuser>",
        "password": "<agreatpassword>"
    },
    "redis": {
        "host": "127.0.0.1",
        "port": "6379",
        "password": "<agreatpassword>"
    },
    "mailer": {
        "host" : "smtp-relay.gmail.com",
        "port": 465,
        "secureConnection": true,
        "user": "user@newdomain.com",
        "password": "<areallygreatpassword>",
        "from": "The Cloud <Cloud@newdomain.com>"
    },
    "legal": {
        "terms" : "",
        "policy": ""
    },
    "registration_enabled": false
}

I kept troubleshooting, though, and for future readers. I found another set of logs.

First, the MongoDB error is not related to the version of Mongoose as other posters surmised; I realized I had forgotten to open port 27017 in the AWS security groups which resolved that warning.

I found logs in the logs folder, of all the crazy things, and they say:

2022-06-10 06:02:11:1111 info: openHAB-cloud: Backend service is starting up...
2022-06-10 06:02:11:1111 info: openHAB-cloud: Backend logging initialized...
2022-06-10 06:02:11:1111 info: openHAB-cloud: Initializing XMPP connection to GCM
2022-06-10 06:02:11:1111 info: openHAB-cloud: Connecting to Redis at 127.0.0.1:6379
2022-06-10 06:02:12:1212 info: openHAB-cloud: Mailer will emulate sending in development environment
2022-06-10 06:02:12:1212 error: uncaughtException: Cannot read property 'createClient' of undefined
TypeError: Cannot read property 'createClient' of undefined
    at new RedisStore (/home/centos/openhab-cloud/node_modules/cacheman-redis/node/index.js:68:41)
    at Cacheman.engine (/home/centos/openhab-cloud/node_modules/cacheman/node/index.js:194:24)
    at new Cacheman (/home/centos/openhab-cloud/node_modules/cacheman/node/index.js:152:10)
    at new Cache (/home/centos/openhab-cloud/node_modules/cachegoose/out/cache.js:7:17)
    at module.exports (/home/centos/openhab-cloud/node_modules/cachegoose/out/cache.js:28:10)
    at init (/home/centos/openhab-cloud/node_modules/cachegoose/out/index.js:11:43)
    at Object.<anonymous> (/home/centos/openhab-cloud/app.js:102:1)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
    at internal/main/run_main_module.js:17:47
2022-06-10 06:02:12:1212 error: undefined
2022-06-10 06:02:12:1212 info: openHAB-cloud: Redis connect response: OK
2022-06-10 06:02:12:1212 info: openHAB-cloud: Redis is ready
2022-06-10 06:02:12:1212 warn: openHAB-cloud: GCM XMPP error: Error: self signed certificate
2022-06-10 06:02:12:1212 error: XMPP Error Error: self signed certificate
2022-06-10 06:02:13:1313 warn: openHAB-cloud: GCM XMPP error: Error: self signed certificate
2022-06-10 06:02:14:1414 warn: openHAB-cloud: GCM XMPP error: Error: self signed certificate
2022-06-10 06:02:15:1515 warn: openHAB-cloud: GCM XMPP error: Error: self signed certificate

It looks now like Cachegoose is the problem, and that started out complaining about the Mongoose version initially.

    "bcrypt": "^5.0.1",
    "bcrypt-cache": "^2.0.1",
    "bcryptjs": "^2.4.3",
    ...
    "cachegoose": "8.0.0",
    ...
    "connect-mongo": "^4.2.2",
    "connect-redis": "5.1.0",
    ...
    "mongoose": "^5.12.1",
    "mongoose-types": "1.0.3"

Thanks for taking a look!

Ok, further troubleshooting. I found that cachegoose is seeking a new maintainer as the old one is no longer interested. Last commit 3 years ago. See: GitHub - boblauer/cachegoose: Simple, integrated caching for Mongoose queries.

I also found recachegoose (https://www.npmjs.com/package/recachegoose) which supports Node > 12 and current versions on Mongoose.

So, I replaced cachegoose 8.0.0 with recachegoose 9.0.0 and was able to pass this step.

npm uninstall cachegoose
npm install recachegoose

Modify app.js, line 101:

// MongoDB Caching for Item updates
- var cachegoose = require('cachegoose');
+ var cachegoose = require('recachegoose');

Fixed an issue with service account access to MongoDB and now the application starts error-free and I am able to access the login screen.

Thanks again!

1 Like