Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client network socket disconnected before secure TLS connection was established #2810

Open
Toritos01 opened this issue Jul 30, 2024 · 0 comments
Labels

Comments

@Toritos01
Copy link

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)"}
@Toritos01 Toritos01 added the Bug label Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant