Skip to content

ConnectionTimeoutError: Connection timeout #2550

@Thalari-Kolarivan

Description

@Thalari-Kolarivan

Description

Code snippet for connecting the redis is below.

    this.client = redis.createClient({
      socket: { host: redisHost, port: REDISPORT},
    });
    this.client.connect();
    this.client.on("error", (err) => log.error("Error in redis :", err));

The error we got in our logs is below.

    ConnectionTimeoutError: Connection timeout
    at Socket.<anonymous> (/workspace/node_modules/@redis/client/dist/lib/client/socket.js:178:124)
    at Object.onceWrapper (node:events:627:28)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12)
    at Socket._onTimeout (node:net:550:8)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)

We also tried configuring connectTimeout for 10 seconds in the createClient after that we didn't get this error. Should we have to configure the timeout ?
Can we have a proper solution or a work around for this Connection Timeout Error?

Node.js Version

v16.19.1

Redis Server Version

6.2.7

Node Redis Version

4.6.7

Platform

Google appengine

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