tkurki/signalk-mqtt-gw

Embedded server unusable because of a breaking dependency update of Mosca ==> jsonschema@>1.2.6

jpsuter opened this issue · 8 comments

with the last updates (server and plugin), there is an error :
Signal K - MQTT Gateway |   | Failed to start: Expected schema to be an object or boolean
some search leave me perplexe :
better to run aedes than mosca, it's broken after it's dependency jsonschema updated to version 1.2.8, you can manually install jsonschema 1.2.6 to run it without error. it's not yet broken before updated to 1.2.8

How to downgrade? i installed via home assistant, and thats how far my knowledge goes ))

As I am not currently using this plugin myself the obvious fix, moving on to Aedes from the unmaintained Mosca, is not going to happen in a hurry.

I am tempted to publish a version that drops the embedded version. That would break things for people using it, but maybe they can install manually the version with Mosca still there.

No good way forward I'm forward - unless somebody is willing to step in and do the switch to Aedes.

I don't understand how Home Assistant is connected, but in a normal Signal K installation try running npm install jsonschema@1.2.6 in you $HOME/.signalk directory to downgrade.

comment this line in validator.js (\node_modules\jsonschema\lib\validator.js:111):

if((typeof schema !== 'boolean' && typeof schema !== 'object') || schema === null){
throw new SchemaError('Expected schema to be an object or boolean');
}

Fix attempt in signalk-mqtt-gw@1.3.4 - please reopen if it doesn't fix the problem.

encountered the same error in 1.3.4, had to manually npm install jsonschema@1.2.6 to get the mqtt gateway (with "Run local server" enabled) to run again:

Feb 04 23:41:49 error starting plugin: SchemaError: Expected schema to be an object or boolean
Feb 04 23:41:49 SchemaError: Expected schema to be an object or boolean at Validator.validate (/home/pi/.signalk/node_modules/jsonschema/lib/validator.js:110:11) at Object.validate (/home/pi/.signalk/node_modules/mosca/lib/options.js:264:26) at new Server (/home/pi/.signalk/node_modules/mosca/lib/server.js:104:34) at startLocalServer (/home/pi/.signalk/node_modules/signalk-mqtt-gw/index.js:162:14) at Object.plugin.start (/home/pi/.signalk/node_modules/signalk-mqtt-gw/index.js:105:7) at doPluginStart (/usr/lib/node_modules/signalk-server/lib/interfaces/plugins.js:264:20) at doRegisterPlugin (/usr/lib/node_modules/signalk-server/lib/interfaces/plugins.js:387:13) at registerPlugin (/usr/lib/node_modules/signalk-server/lib/interfaces/plugins.js:218:13) at /usr/lib/node_modules/signalk-server/lib/interfaces/plugins.js:169:13 at Array.forEach () at startPlugins (/usr/lib/node_modules/signalk-server/lib/interfaces/plugins.js:168:85) at Object.start (/usr/lib/node_modules/signalk-server/lib/interfaces/plugins.js:35:13) at /usr/lib/node_modules/signalk-server/lib/index.js:440:70 at /usr/lib/node_modules/signalk-server/node_modules/lodash/lodash.js:4967:15 at Function.forIn (/usr/lib/node_modules/signalk-server/node_modules/lodash/lodash.js:13018:11) at startInterfaces (/usr/lib/node_modules/signalk-server/lib/index.js:430:22) at /usr/lib/node_modules/signalk-server/lib/index.js:278:17 at createServer (/usr/lib/node_modules/signalk-server/lib/index.js:398:5) at /usr/lib/node_modules/signalk-server/lib/index.js:267:13 at new Promise () at Server.start (/usr/lib/node_modules/signalk-server/lib/index.js:266:16) at Object. (/usr/lib/node_modules/signalk-server/bin/signalk-server:26:8) at Module._compile (node:internal/modules/cjs/loader:1126:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10) at Module.load (node:internal/modules/cjs/loader:1004:32) at Function.Module._load (node:internal/modules/cjs/loader:839:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47