Skip to content

Infinite wait while connecting to TLS protected cluster (AWS MemoryDB) #2477

Open
@DKurilo

Description

@DKurilo

Description

I know it's not exactly Redis related and I don't know if it's reproducible for Redis cluster.
But given an AWS MemoryDB cluster (that behaves as Redis at least in documentation) that is protected by TLS.
Have cluster defined as:

    this.redisCluster = createCluster({
      rootNodes: [
        {
          url: 'rediss://host:6379',
        },
      ],
      defaults: {
        username: options.username,
        password: options.password,
      },
    });
    await this.redisCluster.connect(); // it freezes here

Last line never resolves. Because by default we have minimizeConnections as false and then RedisCluster start checking all the slots and all other slots it checks without tls: true option. Possible solution is to use tls in case we have tls in rootNodes or at least to add this to documentation.
As workaround:

    this.redisCluster = createCluster({
      rootNodes: [
        {
          url: options.redisUrl,
        },
      ],
      defaults: {
        username: options.username,
        password: options.password,
        ...(options.redisUrl.startsWith('rediss')
          ? { socket: { tls: true } }
          : {}),
      },
    });

I don't know if it should be fixed, maybe it should be just described in documentation

Node.js Version

v18.16.0, v19.8.1

Redis Server Version

6.2.6

Node Redis Version

1.5.6

Platform

alpine linux, macOS

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions