Code Monkey home page Code Monkey logo

Comments (6)

Wcctnoam avatar Wcctnoam commented on May 24, 2024 1

Quick and final update:

I fixed the bson error, upgraded the node-red-contrib-contextbrowser package, and thoroughly ran npm update. Their respective output messages went away from the startup, but the error persisted.

We have, however, found a solution. We noticed this under the 0.17 release notes:

Other nodes

As ever, there is a collection of smaller updates to other nodes.

[...]
The TLS config node now allows the required certificate files to be uploaded in the editor rather than point at local files.

I uploaded the certificate and told the nodes to use it, instead of pointing at its location, and now everything works just as it used to. It's important to note however, that the certificate are exactly the same, the very same file, which means that something about reading it from the location was screwing with it, so you probably want to check that out.

This issue is as good as closed for me. Thanks for all the help, and I hope this has helped other people.

from node-red-docker.

jthomas avatar jthomas commented on May 24, 2024

Thanks for reporting this issue.

I've tested running the following command (0.17.4) to connect to the public Eclipse broker.

docker run -it -p 1880:1880 --name mynodered nodered/node-red-docker

Using this flow, it does connect and I can see the messages coming through.

[{"id":"757fb087.474b3","type":"mqtt out","z":"9915942e.6c4678","name":"","topic":"docker","qos":"","retain":"","broker":"439fa779.a3c838","x":541.5,"y":182,"wires":[]},{"id":"637d4c72.82cc24","type":"mqtt in","z":"9915942e.6c4678","name":"","topic":"docker","qos":"2","broker":"439fa779.a3c838","x":258.5,"y":67,"wires":[["9fdd2cd7.86554"]]},{"id":"9fdd2cd7.86554","type":"debug","z":"9915942e.6c4678","name":"","active":true,"console":"false","complete":"true","x":549.5,"y":69,"wires":[]},{"id":"fa993cce.6d1fb","type":"inject","z":"9915942e.6c4678","name":"","topic":"","payload":"hello world","payloadType":"str","repeat":"","crontab":"","once":false,"x":195.5,"y":171,"wires":[["757fb087.474b3"]]},{"id":"439fa779.a3c838","type":"mqtt-broker","z":"","broker":"iot.eclipse.org","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

Can you try this out? Where and how are you running your Docker images?

Here's the console output I'm seeing for the above command.

npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info lifecycle [email protected]~prestart: [email protected]
npm info lifecycle [email protected]~start: [email protected]

> [email protected] start /usr/src/node-red
> node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"

10 Jul 13:24:45 - [info]

Welcome to Node-RED
===================

10 Jul 13:24:45 - [info] Node-RED version: v0.17.3
10 Jul 13:24:45 - [info] Node.js  version: v6.11.0
10 Jul 13:24:45 - [info] Linux 4.9.31-moby x64 LE
10 Jul 13:24:45 - [info] Loading palette nodes
10 Jul 13:24:46 - [warn] ------------------------------------------------------
10 Jul 13:24:46 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
10 Jul 13:24:46 - [warn] ------------------------------------------------------
10 Jul 13:24:46 - [info] Settings file  : /data/settings.js
10 Jul 13:24:46 - [info] User directory : /data
10 Jul 13:24:46 - [info] Flows file     : /data/flows.json
10 Jul 13:24:46 - [info] Creating new flow file
10 Jul 13:24:46 - [info] Server now running at http://127.0.0.1:1880/
10 Jul 13:24:46 - [info] Starting flows
10 Jul 13:24:46 - [info] Started flows
10 Jul 13:27:29 - [info] Stopping flows
10 Jul 13:27:30 - [info] Stopped flows
10 Jul 13:27:30 - [info] Starting flows
10 Jul 13:27:30 - [info] Started flows
10 Jul 13:27:30 - [info] [mqtt-broker:439fa779.a3c838] Connected to broker: mqtt://iot.eclipse.org:1883

from node-red-docker.

Wcctnoam avatar Wcctnoam commented on May 24, 2024

Hello, thank you for the reply.

Your flow works fine, so now I'm even more puzzled. I can't share my flow because of company policy, but I've more than checked that the IP, port, user, password and SSL certificates in the node's configuartion are all what they're supposed to be in order to connect to my Mosquitto docker.

I'm running everything on a Ubuntu VM, hosted via a Windows Server 2012 R2 and its Virtual Machine Manager (surely not the issue, but I'm all for complete information).
My Node-Red containers are started like this:
sudo docker run -u root --restart=on-failure:10 -id -p 1880:1880 -v ~/node-red-data:/data --name mynodered nodered/node-red-docker:**[VERSION]**
With the mounted volumes, regardless of version the containers share settings and node_modules, so I've discarded their possible responsability in the error.

My Mosquitto container is run like so:
sudo docker run -id --restart=on-failure:10 -p 8883:8883 -p 9001:9001 -v ~/mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf -v ~/mosquitto/certs:/mosquitto/certs -v ~/mosquitto/data:/mosquitto/data -v ~/mosquitto/log:/mosquitto/log -v ~/mosquitto/acl:/mosquitto/acl --name mqttbroker eclipse-mosquitto

They're both on the default bridge network.

Here's the output for starting a Node-Red container version 0.16.2:

11 Jul 08:45:41 - [info]

Welcome to Node-RED
===================

11 Jul 08:45:41 - [info] Node-RED version: v0.16.2
11 Jul 08:45:41 - [info] Node.js  version: v6.11.0
11 Jul 08:45:41 - [info] Linux 4.4.0-81-generic x64 LE
11 Jul 08:45:41 - [info] Loading palette nodes
11 Jul 08:45:44 - [warn] [node-red-contrib-contextbrowser] Node module cannot be loaded on this version. Requires: >=0.17.0
{ Error: Cannot find module '../build/Release/bson'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/data/node_modules/bson/ext/index.js:15:10)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3) code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
11 Jul 08:45:51 - [warn] ------------------------------------------------------
11 Jul 08:45:51 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
11 Jul 08:45:51 - [warn] ------------------------------------------------------
11 Jul 08:45:51 - [warn] Missing node modules:
11 Jul 08:45:51 - [warn]  - node-red-contrib-contextbrowser: contextbrowser, contextbrowser-sidebar
11 Jul 08:45:51 - [info] Removing modules from config
11 Jul 08:45:51 - [info] Settings file  : /data/settings.js
11 Jul 08:45:51 - [info] User directory : /data
11 Jul 08:45:51 - [info] Flows file     : /data/flows.json
11 Jul 08:45:51 - [info] Server now running at http://127.0.0.1:1880/
11 Jul 08:45:51 - [debug] loaded flow revision: 2de865226db2cf5ead2e64ded9445282
11 Jul 08:45:51 - [debug] red/runtime/nodes/credentials.load : no user key present
11 Jul 08:45:51 - [debug] red/runtime/nodes/credentials.load : using default key
11 Jul 08:45:51 - [info] Starting flows
11 Jul 08:45:51 - [info] [inject:6c5e27a3.74c0f8] repeat = 6000
11 Jul 08:45:52 - [info] [inject:Check Gateway status] repeat = 31000
11 Jul 08:45:52 - [info] [python-function:c7430adf.cbdd58] Python function '' running on PID 32
11 Jul 08:45:52 - [info] Started flows
11 Jul 08:45:52 - [info] [mqtt-broker:a396410d.71b84] Connected to broker: mqtts://**[PUBLIC_IP]**:8883
11 Jul 08:45:52 - [info] [mqtt-broker:d82cde33.a7ba7] Connected to broker: mqtts://**[INTERNAL_IP]**:8883 // These two lines show a correct connection to my mosquitto container, through two different IPs asigned to the host machine.
11 Jul 08:45:52 - [info] [ttn app:394c1391.846e9c] Connected to TTN application testing_app_002
11 Jul 08:45:52 - [info] [mqtt-broker:2b29ab7.906cb54] Connected to broker: mqtt://iot.eclipse.org:1883
11 Jul 08:45:52 - [info] [ttn app:c1dfde29.c8968] Connected to TTN application testing_app_003

Here's the output of starting Node-Red container version 0.17.4:

11 Jul 08:27:38 - [info]

Welcome to Node-RED
===================

11 Jul 08:27:38 - [info] Node-RED version: v0.17.4
11 Jul 08:27:38 - [info] Node.js  version: v6.11.0
11 Jul 08:27:38 - [info] Linux 4.4.0-81-generic x64 LE
11 Jul 08:27:39 - [info] Loading palette nodes
{ Error: Cannot find module '../build/Release/bson'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/data/node_modules/bson/ext/index.js:15:10)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3) code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
11 Jul 08:27:41 - [warn] ------------------------------------------------------
11 Jul 08:27:41 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
11 Jul 08:27:41 - [warn] ------------------------------------------------------
11 Jul 08:27:41 - [info] Settings file  : /data/settings.js
11 Jul 08:27:41 - [info] User directory : /data
11 Jul 08:27:41 - [info] Flows file     : /data/flows.json
11 Jul 08:27:41 - [info] Server now running at http://127.0.0.1:1880/
11 Jul 08:27:41 - [debug] loaded flow revision: 2de865226db2cf5ead2e64ded9445282
11 Jul 08:27:41 - [debug] red/runtime/nodes/credentials.load : no user key present
11 Jul 08:27:41 - [debug] red/runtime/nodes/credentials.load : using default key
11 Jul 08:27:41 - [info] Starting flows
11 Jul 08:27:41 - [debug] red/nodes/flows.start : starting flow : global
11 Jul 08:27:41 - [debug] red/nodes/flows.start : starting flow : b8183da5.b7a0d
11 Jul 08:27:41 - [debug] red/nodes/flows.start : starting flow : 74a79f12.b7e46
11 Jul 08:27:41 - [debug] red/nodes/flows.start : starting flow : 97581168.06c34
11 Jul 08:27:41 - [debug] red/nodes/flows.start : starting flow : 778ebfa1.31277
11 Jul 08:27:42 - [info] [inject:6c5e27a3.74c0f8] repeat = 6000
11 Jul 08:27:42 - [info] [inject:Check Gateway status] repeat = 31000
11 Jul 08:27:42 - [info] [python-function:c7430adf.cbdd58] Python function '' running on PID 32
11 Jul 08:27:42 - [info] Started flows
11 Jul 08:27:42 - [info] [ttn app:394c1391.846e9c] Connected to TTN application testing_app_002
11 Jul 08:27:42 - [info] [mqtt-broker:2b29ab7.906cb54] Connected to broker: mqtt://iot.eclipse.org:1883
11 Jul 08:27:42 - [info] [ttn app:c1dfde29.c8968] Connected to TTN application testing_app_003

The bson error is one I've had for a while and still haven't gotten around to fix, but it's present in both version and hasn't been problematic so far (unless the new versions changed that). The node-red-contrib-contextbrowser package is one of the reasons we decided to update our image, so there's a warning on the 0.16.2 vesion.

I can't think of anything else to share, but please ask for anything that might help.

Thanks.

from node-red-docker.

jthomas avatar jthomas commented on May 24, 2024

If you docker exec into the Node-RED container and use an MQTT client to manually connect to the Mosquitto broker, can you make a successful connection?

One solution would be to stick with the earlier version and manually upgrade the node-red-contrib-contextbrowser package. Unfortunately, I'm running out of ideas as to the cause of this bug.

from node-red-docker.

Wcctnoam avatar Wcctnoam commented on May 24, 2024

I just tested that mosquitto_sub works perfectly with both versions. The parameters were all the same as for the nodes (IP, port, certificate, user and password).

I'm going to work on the contextbrowser package and the bson error and report on those ventures later.
However, for now I'm quite alright with running the 0.16.2. It works for what we're working on, we just wanted the extra commodity of some of the new features.

Thanks for the assistance.

from node-red-docker.

jthomas avatar jthomas commented on May 24, 2024

Hurrah, glad you got this fixed, good work! 💯

from node-red-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.