"MongoError: pool destroyed" in NodeRED - javascript

We are having windows server on which linux VM is installed.
On windows server we have -
MongoDB 3.6.17 Community Edition /
Node.js v10.19.0
On Linux VM we have installed NodeRed container /
Node.js v16.17.1
As mongoDB and Nodered are in same subnet we are able to establish communication between them.
On linux VM we have installed Azure IoT Edge and Nodered container is running on the top of it.
I am fetching data from MongoDB into NodeRED and then processing it further.
This flow works absolutely fine, however in some cases I am getting this error - "MongoError: pool destroyed".
After this I am not able to fetch data from MongoDB.
Once I Open/Close debug node and deploy the flow it starts to work again.
I'm using:
node-red-node-mongodb (0.2.5)
Can anyone please suggest what might be the root cause for this problem?
Can the differences in Node.js versions in windows and linux create an issue?
Please refer image for your reference -

Related

How access Realm Mobile Platform from Node.js client?

I am running Realm Mobile Platform on Ubuntu Server 16.04.2 virtual machine and I am able to access the HTML admin panel and connect to the server using Realm OS X browser.
On the server, would be possible to install NPM realm package an connect to the local database as admin user?
I tried calling Realm.Sync.User.login from Node.js console, but I am get an error informing that Realm.Sync is not available at developer edition.
using the node.js Realm SDK with sync is limited to the professional edition. If you would like to use the node SDK with sync you can either get a free trial or install it on an OSX machine.

Install node.js at Shared Dreamhost

Im trying to install node.js to shared dreamhost. I have followed the directions for Dan dean here http://dandean.com/nodejs-on-dreamhost-shared-server/
but when I go test,
$ node --version
Then it says:
-bash: node: command not found
I follow the step by step, this is the correct way to install the node in the shared server?
Dreamhost has supported Node.js on shared host recently.
I put the following source code in app.js and it works.
var http = require('http');
var server = http.createServer(function(req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end("Hello World!\n");
});
server.listen(3000);
But it seems to be unstable when I try to restart it.
Check https://help.dreamhost.com/hc/en-us/articles/217185397-Node-js-overview for details.
You may want to look into nvm when installing Node somewhere else than your local environment.
Check out my blog post on nvm:
http://mycodesmells.com/post/node-version-management/
Sometimes, installing node.js on certain linux instances creates the command nodejs instead of node. Try nodejs --version. If you want to be able to use node as the command, simply create a simlink to /usr/local/bin/nodejs for /usr/local/bin/node.
Currently DreamHost says “Node.js can be installed onto Shared, VPS, and Dedicated Servers.” However, for shared servers, currently Node is only supported using Passenger, and the version of Passenger “running on DreamHost servers does not currently function with Node.js versions 14+” as of March 1, 2022. They have not shared a target date for allowing newer versions of Node.
For more instructions, and up-to-date compatibility information, see their support documentation on Node.js at Dreamhost.
It may not have been the case at the time this question was posted, but Dreamhost does not allow compiling or running nodejs on shared hosting.
Can Node.js be used on shared servers?
No. DreamHost does not support Node.js on shared web servers, as the security setup on DreamHost shared servers is incompatible with compiling or running Node.js.
Furthermore, Dreamhost claims they will ban users who attempt to do so:
If you try to compile Node.js on one of the shared web servers, your user will automatically be banned through grsec (taking down all the PHP websites that run under that user) and the server will have to be rebooted before your user can be unbanned. If you do it one more time, you will be forced to move to a VPS.
I've had Dreamhost shared hosting for nearly 10 years, but they don't allow long-running processes. This also prevents common tools like composer from running if they take more than a few seconds. I recently moved to a VPS because of this.
https://help.dreamhost.com/hc/en-us/articles/217185397-Node-js-overview

Kurento Media Server HelloWorld Javascript example webSocket error

Merry Christmas!
I am trying to configure KMS on my Ubuntu 14.04 (64 bit). I could install the KMS server successfully following the guide at https://www.kurento.org/docs/6.0.0/installation_guide.html.
Also, downloaded the Javascript HelloWorld tutorial from https://www.kurento.org/docs/6.0.0/tutorials/js/tutorial-1-helloworld.html. I could run the example successfully on localhost on Google Chrome Version 47.0.2526.106 (64-bit) on the same Ubuntu System.
But, I could not see the local video nor the loop backed video. Only a spinner icon is shown on both the Video placeholders. Consulting the Console log reveals a problem after creating the SDP offer. The error is as described below.
kurento-client.js:21072 WebSocket connection to 'wss://127.0.0.1:8433/kurento' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
I am no expert on web sockets and stuff. Any help on this would really help me to proceed forward.
Note: I am running the example on HTTP, not on HTTPS. I guess that would not be the cause of the problem, though.
Regards,
LazyCoder7
I managed to solve it. I was wrong on my guess though, HTTPS was indeed required in order to make the WebSocket connection ( i was not aware of that part ). Created a certificate file (.pem) (from crt and key file already in the helloworld folder) and configured the KMS server to use the certificate. After this I was able to see myself and the same me in loopback :)
You are following an old version of the documentation. Since Chrome 47, in is mandatory to server pages through HTTPS if you want to use the getUserMedia APi. So we updated all our tutorials, and they now have a self-signed certificate. In case of the JS tutorials, you also need to configure KMS to expose a secure WS signalling connection, as the browser directly connects to the media server to control it.
Please follow the latest version of the documentation here
Be sure that the KMS is running on the port 8433 (not 8888), if you are using docker
docker run -d --name kms -p 8433:8433 kurento/kurento-media-server:trusty-latest

Can't connect to local Node App

I just started with a little bit MEAN-Magic by following along this tutorial. It was working pretty good (installation and so on). Now I'm stuck at:
STEP 4: Creating an ExpressJS application
I executed express mytestapp, cd mytestapp, npm installand node app.jsand am able to see the folder structure in the Terminal, but if I open Safari with "http://localhost:3000" I get the message
Safari can't Connect To Server... Safari can't open the page "localhost:3000" because Safari can't connect to the server "localhost"
How can I troubleshoot this? I'm totally new to this. (Not sure if this matters, but I'm working from a mac at the moment).

Node.js, express and cluster

I have setup a test of a Node.js server but how is the server best launched?
My strategy for now is to use cluster (http://learnboost.github.com/cluster/). This mostly works really nice. I have the following setup in my app.js file (created with express):
cluster(app)
.use(cluster.reload())
.use(cluster.reload('views', {extensions: ['.js', '.ejs']}))
.use(cluster.logger('logs'))
.use(cluster.stats())
.use(cluster.repl('/Users/testuser/work/1test/test.sock'))
.use(cluster.debug())
.use(cluster.pidfiles())
.use(cluster.cli())
.listen(3000);
It works on my Mac when i test locally. I launch it with the command
nohup node app.js &
But when I run on Linux and detach from the terminal the master dies - the working threads are still working. On the Mac it runs even when I close the terminal.
I read that it might be necessary to change the user, this can apparently be done in cluster with:
.set('user', 'rambo')
Does anyone have a "best practice" for launching node.js as a "Daemon" with cluster so you can detach the terminal?
If I change the user who should I be logged in as when I launch?
Should I use a program such as screen to detach from the terminal without killing any processes?
try forever.
npm install -g forever
https://github.com/indexzero/forever
Looks like you're also setting
.use(cluster.repl('/Users/testuser/work/1test/test.sock'))
which probably doesn't exist on your linux server.

Categories