Description
Description
I am currently trying to connect to Azure Redis Cache with clustering and TLS enabled.
However when I do this, I get an error connecting to one of the specific ports.
{"code":"ECONNRESET","host":"20.169.168.49","port":15001,"name":"Error","message":"Client network socket disconnected before secure TLS connection was established","stack":"Error: Client network socket disconnected before secure TLS connection was established\n at connResetException (node:internal/errors:720:14)\n at TLSSocket.onConnectEnd (node:_tls_wrap:1714:19)\n at TLSSocket.emit (node:events:529:35)\n at endReadableNT (node:internal/streams/readable:1400:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"}
My constructor looks like this:
const host: string = "[cacheName].redis.cache.windows.net"; const port: string = 6380; const connString: string =
rediss://${host}`;
this.internalClient = createCluster({
rootNodes: [
{
url: `${connString}:${port}`,
},
],
useReplicas: true,
defaults: {
// The username and password being used here are a managed identity OID and access token
username: options?.redisOptions?.username,
password: options?.redisOptions?.password,
pingInterval: 10000,
socket: {
tls: true,
servername: host,
keepAlive: 300000,
reconnectStrategy: (retries) => {
if (retries < 10) {
return 2000;
} else {
return false;
}
},
},
},
},
);
`
I have also tried with useReplicas as false.
One strange thing I notice is that it only gives this error for port 15001, regardless of whether that port is for the primary node or the replica. The Azure Redis Cache currently has two shards configuration.
Node.js Version
18.17.0
Redis Server Version
6.0.14
Node Redis Version
4.6.15
Platform
Windows
Logs
{"code":"ECONNRESET","host":"20.169.168.49","port":15001,"name":"Error","message":"Client network socket disconnected before secure TLS connection was established","stack":"Error: Client network socket disconnected before secure TLS connection was established\n at connResetException (node:internal\/errors:720:14)\n at TLSSocket.onConnectEnd (node:_tls_wrap:1714:19)\n at TLSSocket.emit (node:events:529:35)\n at endReadableNT (node:internal\/streams\/readable:1400:12)\n at process.processTicksAndRejections (node:internal\/process\/task_queues:82:21)"}