kpine / zwave-js-server-docker

A minimal docker container for zwave-js-server
MIT License
52 stars 10 forks source link

TypeError: Cannot set property 'S0_Legacy' of undefined #8

Closed CrossEyeORG closed 3 years ago

CrossEyeORG commented 3 years ago

I am on the latest branch kpine/zwave-js-server:latest and am now receiving the following error,

Starting zwave-server: zwave-server --config options.js /dev/zwave
Error: failed loading config file /app/options.js
TypeError: Cannot set property 'S0_Legacy' of undefined
    at /app/node_modules/@zwave-js/server/dist/bin/server.js:66:48
    at Object.<anonymous> (/app/node_modules/@zwave-js/server/dist/bin/server.js:116:3)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47

Validated that rolling back to version 1.10.0-8.2.0 I was able to get around the above issue.

Looking at the latest pull requests, I am seeing Add S2 key support #7 which is where I think the above bug was introduced in version 1.10.1-8.2.1.

kpine commented 3 years ago

This is a bug in zwave-js-server. I'll report it there.

kpine commented 3 years ago

For reference: https://github.com/zwave-js/zwave-js-server/issues/355

Thanks for the report.

kpine commented 3 years ago

Meanwhile, if you're looking for some workarounds, you can either try the kpine/zwave-js-server:s2 image, which is based on that PR, or you can mount a modified options.js file to make the zwave-js-server happy.

module.exports = {
  logConfig: {
    filename: process.env.LOGFILENAME,
    forceConsole: true,
  },

  storage: {
    cacheDir: "/cache",
    deviceConfigPriorityDir: "/cache/config",
  },

  networkKey: process.env.NETWORK_KEY,

  securityKeys: {}
};

You can also manually specify all of the s2 security keys in that file as well, w/o requiring the s2 build. That PR just adds the environment variables.

module.exports = {
  logConfig: {
    filename: process.env.LOGFILENAME,
    forceConsole: true,
  },

  storage: {
    cacheDir: "/cache",
    deviceConfigPriorityDir: "/cache/config",
  },

  securityKeys: {
    S0_Legacy: "1111111111111111",
    ...
  },
};
kpine commented 3 years ago

Fixed with tag 1.10.2-8.2.1 and current latest.