Ubuntu 14.04 with Node.js connection refused on routes - node.js

Using Express, I created a route /users which outputs some random strings. It works fine on my local machine. However, if I deploy my app on DigitalOcean, while viewing IP:port works, if I try my new route IP:port/users the server responds with "connection refused."
Any ideas what I am missing?
Here are the results of netstat:

i was definetly searching in the wrong place... it was the first time i got a "connection refused" from a server on an actual database error. i removed everything out of the actual route and really just used plain text as output. the problem was simple just a misconfiguration of the mysql connection and the database itself.
thanks anyways for the fast response and putting my wierd english words into the right order.

Related

Server is running but getting "could not proxy request from localhost to localhost" error on react

So I am in a very weird situation.
I have a react app with node js backend which was working just fine a couple of days ago.
I don't know what happened but the client stopped connecting to the server by returning a message "Proxy error: Could not proxy request".
I then tried testing just the server side and sent a few different requests via postman. I had these requests saved in my postman as I used them a thousand times before and they all worked fine. But then postman comes back with "Client sent an HTTP request to an HTTPS server".
I checked hundred times my server is running, I can see in the console "Listening on port 5001...".
Furthermore, I tried running the app on another machine, my laptop, and it works all good.
I have spent two days on this issue and I have no clue what's going on.
Things I tried:
all proxy related suggestions on stackoverflow such as changing localhost to 127.0.0.1 or adding a "/", etc.
deleted node modules, and reinstalled
deleted the repo and recloned
tried running on node instead of nodemon
I have no clue what happened to my desktop machine that it literally stopped connecting to the server.
I don't know if you'd need to see any piece of code but I am happy to share anything you need, I just don't know what would help to show.

Socket IO - WSS Throwing error -- remote client, local server

Hi I've been trying to figure this out for some time now. It's kind of hard to explain... Ill try and give some background : I'm trying to create a pwa that can work on WAN and LAN for when offline. ---- So I have a client and server, if I host the client and server both locally I'm having no issues I can connect to one another directly and everything, the socket.io and web socket work great. If I host the client and server both on Heroku they work great as well. The problem comes when I host the client on Heroku and the server locally -- which in the application I'm working on I need this. Im able to still connect to the other user if im using the WAN connection portion but if I try to make the connection using LAN it throws errors. I'm not sure what is going on, I'm still fairly new socketio, websockets, etc... ---- Here is the error I am getting Error Image. Here are my imports on the server - imports-server, how I'm setting up the server - server setup, how I set up the connection on the client -- client setup. Sorry if I wasn't clear on my explanation, thank you for help.

queryTxt ETIMEOUT merncluster-0jdze.mongodb.net

I'm using nodejs with MongoDB server using mongoose, whenever I try to run my server, it won't connect to my database. After sometime above log is seen on CMD. My cluster name is merncluster here!!
Is there any solution to this, I've searched a lot, still can't find proper solution to this, this keeps happening all the time.
You may need to whitelist your IP address in MongoDB Atlas.
Adding 8.8.8.8 to my connection to the internet works for me.

Connecting to a mongoDB with a TCP prefix on a NodeJS application

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.

How to tell on Linux (Lucid) if a connection is coming into the server?

So I have an issue where I am remotely connecting to a Mongodb on my linode box, and I am not longer able to access this DB. I can from my local machine, but when I am on this remote server (where the website runs) it is not working. I am not seeing the connection come into the Mongo logs, so this leads me to believe that maybe it is being intercepted by a firewall?
How can I watch traffic and see if this connection is at least making it to my linode box? I am connecting with Mongoid, so if there is a way to prove no connection there too.
Right now the only error I get is a erb view timeout execution error - not much to go on.
Thanks,
Daniel

Resources