-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
Description
Description
Here is my code:
import { createCluster } from "redis";
export async function makeClient() {
const client = createCluster({ rootNodes: [ { url: process.env.REDIS_URL } ] })
.on('error', err => {
console.log('Redis Client Error', { err })
}).connect()
return client
}This will not error but it hangs forever.
The REDIS_URL is formatted like: rediss://:XXXXXX@HOST:PORT?ssl_cert_reqs=optional
However it works if I use ioredis with this code:
import Redis from 'ioredis'
const [_, password, host, port] = process.env.REDIS_URL!.match(/rediss:\/\/:(.*)@(.*):(\d*).*/)!
const Cluster = new Redis.Cluster([
{
host,
port: Number(port),
}
], {
dnsLookup: (address, callback) => callback(null, address),
redisOptions: {
password,
tls: {}
}
})
console.log({ Cluster })Being that ioredis is depricated I would prefer to use this library. Is there a solution?
Node.js Version
v18.20.8
Redis Server Version
No response
Node Redis Version
No response
Platform
No response