iuriaranda / signalk-mqtt-bridge

SignalK Node server plugin that acts as a bridge between SignalK data and MQTT
MIT License
5 stars 2 forks source link

path.replaceAll is not a function at signalkPathToMqttTopic #3

Closed anhorbc closed 1 year ago

anhorbc commented 1 year ago

Installed plugin and configured it to a mosquitto broker. the signalk keepalive topic is published to the broker, but I cannot get any sk paths to be published. signalk log is full of the following messages:

Feb 17 16:32:31 TypeError: path.replaceAll is not a function at signalkPathToMqttTopic (/data/conf/signalk/node_modules/signalk-mqtt-bridge/index.js:333:17) at handleDelta (/data/conf/signalk/node_modules/signalk-mqtt-bridge/index.js:187:36) at /usr/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:1048:16 at /usr/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:463:23 at processAfters (/usr/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:359:11) at Object.inTransaction (/usr/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:439:9) at Dispatcher.push (/usr/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:1214:24) at Dispatcher.handleEvent (/usr/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:1267:17) at Bus.sink (/usr/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:242:17) at Bus.push (/usr/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:2371:21) at StreamBundle.push (/usr/lib/node_modules/signalk-server/lib/streambundle.js:90:19) at StreamBundle. (/usr/lib/node_modules/signalk-server/lib/streambundle.js:38:22) at Array.forEach () at processIems (/usr/lib/node_modules/signalk-server/lib/streambundle.js:37:19) at StreamBundle. (/usr/lib/node_modules/signalk-server/lib/streambundle.js:57:21) at Array.forEach () at StreamBundle.pushDelta (/usr/lib/node_modules/signalk-server/lib/streambundle.js:52:27) at FullSignalK.emit (events.js:412:35) at FullSignalK.addDelta (/usr/lib/node_modules/signalk-server/node_modules/@signalk/signalk-schema/dist/fullsignalk.js:52:8) at DeltaChain.doProcess (/usr/lib/node_modules/signalk-server/lib/deltachain.js:14:18) at DeltaChain.process (/usr/lib/node_modules/signalk-server/lib/deltachain.js:10:21) at Function.Server.app.handleMessage (/usr/lib/node_modules/signalk-server/lib/index.js:177:32) at Simple. (/usr/lib/node_modules/signalk-server/lib/pipedproviders.js:60:17) at Simple.emit (events.js:412:35) at addChunk (internal/streams/readable.js:290:12) at readableAddChunk (internal/streams/readable.js:265:9) at Simple.Readable.push (internal/streams/readable.js:204:10) at Simple.Transform.push (internal/streams/transform.js:166:32)

Any suggestions?

anhorbc commented 1 year ago

For what it's worth, it seems like mqtt->signalk is working.

iuriaranda commented 1 year ago

hmm interesting, there was another issue about the same error, which presumably was due to some source pushing SignalK deltas without a defined path. But normally that should be fixed in version 0.2.3 of the plugin.

Another reason for that error is that you're running a version of Nodejs older than v15. There's a specific function that the plugin uses that's only supported from Nodejs v15 onward.

I'll change that function and use another one with better support in older Nodejs versions.

iuriaranda commented 1 year ago

I've pushed version 0.2.6 of the plugin that should fix the problem :crossed_fingers:

Let me know if it works properly now.

anhorbc commented 1 year ago

Excellent! I can confirm that the error are gone, and paths shows up in the mosquitto broker. Great work!