I am trying to connect redis free cloud instance with bull queue but getting error as it is not able to connect.
- I tried below code:
const Bull = require("bull");
const emailQueue = new Bull("email", {
redis: "",
});
For above code it is giving error Error: connect ECONNREFUSED 127.0.0.1:6379 message.
- Also tried something like this: using tls field but did not work.
const Bull = require("bull");
const emailQueue = new Bull("email", {
redis: {
port: "",
host: "",
tls: { rejectUnauthorized: false },
},
});
Note: I am using redis free cloud instance with bull queue and also download redis insight desktop application. I have added database to redis insight desktop app and it is connected but in node application it is not working. Am I missing any config?
Firstly, you have to ensure that your redis server is running locally since you want to connect to 127.0.0.1:6379.
Secondly, to get the connection error you might be having, you can try this:
For me, I had no issue connecting to my local Redis server but I could not connect to remote Redis servers especially Redis labs and AWS ElasticCache. From the error message, I realized that I needed extra authentication and I just provided the host, port, username, and password for Redis Labs while I only needed to provide a host, port, and password for AWS ElasticCache, leaving the username as an empty string in my env.