I cannot connect to Heroku Redis using TLS. I tried whats given in heroku docs and the answer on this post How to Connect Heroku Redis TLS Node? but nothing seems to work. My current redis options look like:
const Redis = require('ioredis');
const url = process.env.REDIS_URL;
const options = {
tls: {
rejectUnauthorized: false,
},
};
const opts = new Redis(url, options);
Error that I am getting is
[ioredis] Unhandled error event:Error: connect ETIMEDOUT
at TLSSocket.<anonymous
(/app/node_modules/ioredis/built/redis/index.js:310:37)
at Object.onceWrapper (events.js:421:28)
at TLSSocket.emit (events.js:315:20)
.....
Also what is the difference between REDIS_URL and REDIS_TLS_URL? Which one to use?
REDIS_TLS_URL will have an extra 's' in the scheme of the url -> rediss://password@host:port vs. the REDIS_URL (with a single 's' in it's scheme). The other difference is the port. The TLS port is usually +1 of the regular port. On Heroku Redis version 6, you need to use the REDIS_TLS_URL along with tls option you defined above.