I have a Node.js backend which is connected to Firestore and listens for document inserts and updates. At times the internet goes down on server for few minutes but when the connections comes back, the connection to Firestore in not re-established.
I have tested the same on my local also by turning off the internet and getting the same issue.
Node version: v12.14.0
firebase-admin version: "^8.9.2"
But after restarting server things goes back to normal.
Related
We are facing a problem where clients connect to the server and a socket is created and is working.
But for example if the server goes down / we upgrade the version and restart the server,
the sockets are lost until clients refresh the page.
Our clients are passive, and will not refresh the page often leaving the server disconnected for updates and notifications.
We would like to know if it is possible to store the sessions somehow like a mongo store.
I have a MongoDb server setup on my server.
When i start my nodeJs application on it it works perfectly, i can also view and edit my db using the shell when im connected via ssh.
It also used to work with mongo Compass, then a few days suddenly i couldn't connect to my db using compass anymore. Shell and nodeJs connections are still working tho.
I Am getting The Error connect ECONNREFUSED 127.0.0.1:27017
After a Bit looking around an i read a article stating i should look at the log at /var/log/mongodb/mongobd.log
This is The Output from The log, when im trying to connect via ssh. I've already confirmed that this entry is mongo compass trying to connect by restarting and shutting down every service which is using mongodb.
2020-05-03T21:26:19.575+0000 I NETWORK [listener] connection accepted from 127.0.0.1:33694 #5 (3 connections now open)
2020-05-03T21:26:49.689+0000 I NETWORK [conn5] end connection 127.0.0.1:33694 (2 connections now open)
The current application is in development phase and nodejs server is restarted everything any file changes. This lets mongoose reconnect to the MongoDB server.
I am the only one user to connect to remove MongoDB atlas by I don't know how its showing 5 connections are already opened. I don't know-how.
Is there any way to disconnect from MongoDB server before restarting of the application
I am the only one user to connect to remove MongoDB atlas by I don't know how its showing 5 connections are already opened.
There are internal connections used by MongoDB for various purposes like replica set node communications.
Is there any way to disconnect from MongoDB server before restarting of the application
There surely must be but if you are concerned for Atlas having extra connections open, at this scale (5 connections) it is really not worthwhile worrying about it.
I created a NodeJS app that connects with a MongoDB and it seems to work locally.
Now, after hosting the NodeJS application on a remote machine, I am trying to connect to a mongoDB that was already created on that machine. When I print out some of the environment variables, the only one I see of relevance seems to be :
MONGODB_PORT: 'tcp://172.30.204.90:27017',
I tried connecting like I usually do with
mongoose.connect('mongodb://localhost:27017/metadata/')
and replacing it with mongoose.connect('tcp://172.30.204.90:27017/metadata') but I get an error that says my URI needs to start with 'mongodb'.
So I tried replacing it with mongoose.connect('mongodb://172.30.204.90:27017/metadata') and it no longer throws any error. But on the MongoDB side I don't see any new connections happening and my app does not start up on the machine. What should I be putting in the URI?
Your URI should indeed start with mongodb:
mongoose.connect('mongodb://username:password#host:port/database?options...');
See this page for more information: https://docs.mongodb.com/manual/reference/connection-string/
Did you try to connect to the database from cli? Or Telnet to see that connection isn't blocked.
I was working fine with cloudamqp until all of a sudden wascally/rabbot stopped being able to connect to my endpoint. I have installed RabbitMQ locally and my system works fine. I have since then tried to setup a RabbitMq instance on Heroku via bigwig, to no avail. The endpoints I'm using should be fine and I also installed amqp.node and node-amqp to test if maybe it was a problem with rabbot. However none of these can connect either.
Any idea what the problem can be?
the most common cause is connection timeout. with all my wascally code, hosting on cloudamqp (with heroku, digital ocean or otherwise), i have to set a connection timeout much higher than the default for it to work.
this can be done with the connection_timeout parameter on the connection string url (https://www.rabbitmq.com/uri-query-parameters.html)
for example:
var conn = "amqp://myuser:mypassword#server.cloudamqp.com/my-vhost?connection_timeout=30"
this will set a connection timeout of 30 seconds