Heroku redis remote connection - node.js

I have had the redis instance working for some time but now i'm trying to connect to my Redis addon and i'm getting a timeout error while connecting.
My app is made with nodejs, using redis module and i have already tried with process.env.REDIS_URL and with the full url and it's not connecting
Anyone knows if Heroku addons allow remote connection? even with redis -h URL is not working

Related

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.

Unable to connect to node.js server using HTTPS

I'm using Node.js 10.0.0 and trying create a node server that uses HTTPS.
I followed this documentation to create the needed certs and keys etc.
I can connect from localhost to the node server just fine. However, if a Windows machine on the same network as the device running the node server tries to connect to the server using HTTPS the browser says "Trying to establish a secure connection" and times out and the page fails to load.
What am I doing wrong? I'm new to node and HTTPS etc. What can I do to debug this problem?

Docker compose/nodejs: Restart required to connect after ECONNREFUSED

I have a docker-compose file. There is a mysql service and a nodejs service (Nestjs using TypeORM). Sometimes when I bring the stack up, the nestjs service tries to connect to the mysql service before it is ready, and gives me a ECONNREFUSED. I've set it up to retry connecting more or less indefinitely, but once mysql is up, it continues to give me the ECONNREFUSED error.
While it is retrying, and once mysql is up, I can connect to the mysql service using nc mysql 3306, confirming it indeed can. But for some reason I continue to get the ECONNREFUSED error. Once I restart the nodejs service it connects properly. The closest I've come to figuring out the problem is perhaps it has something to do with a Connection Pool that is created in the typeorm package. Any idea how I can deal with this?`

Error during WebSocket handshake on AWS instance

I created a new instance on AWS (Ubuntu) and setted up the app correctly. Everything is fine except socket.io cannot connect using websockets and that kind of creates a lot of lag on mobile phones.
I get this error:
WebSocket connection to <url>' failed: Error during WebSocket handshake: Unexpected response code: 400
This happens only on my EC2 instance. I'm not using any elastic beanstack. Plain simple AWS instance running expressjs server listening on port 80. I read somewhere that nginx is required to be configured. But all I did was fired node server so there is no /etc/nginx directory on the ubuntu instance.
I've been trying to figure this out from very long time. Please help.

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.

Resources