Skip to content

[Bug]: Database API cannot connect to IPv6 only Redis cluster #3992

@connorhsu-sn

Description

@connorhsu-sn

Preconditions (Any important steps we need to know)

We are running Redis Insight and Redis cluster in the same k8s cluster.
I tried ipv6 connection from Redis Insight container to our Redis cluster by

# nc -zv -6 xxxx:xxxx:xxxx:xxxx:xxxx::x:6379
Connection to xxxx:xxxx:xxxx:xxxx:xxxx::x 6379 port [tcp/redis] succeeded!

so it's not network issue.

Steps to reproduce (How to reproduce what you found step by step)

I use the swagger UI (i.e. https://myhost/api/docs#) on POST /api/databases to create a database in Redis Insight.
The payload is like this:

{
  "host": "xxxx:xxxx:xxxx:xxxx:xxxx::x",
  "port": 6379,
  "name": "my-redis-cluster",
  "db": 0,
  "username": "xxx",
  "password": "yyy"
}

Actual behavior (A short description of what you found)

I got error 404:

{
  "message": "The connection has timed out, please check the connection details.",
  "error": "Bad Request",
  "statusCode": 400
}

If I add "timeout": 1000000 to my payload, I got 503:

{
  "message": "Could not connect to xxxx:xxxx:xxxx:xxxx:xxxx::x:6379, please check the connection details.",
  "error": "Service Unavailable",
  "statusCode": 503
}

Note that doing the same POST from the container gives me the same result.

Expected behavior (A short description of what you expected to find)

The API creates a database in Redis Insight successfully.

Screenshots (Paste or drag-and-drop a screenshot or a link to a recording)

N/A

Additional context (Operating system, version of Redis Insight, Redis database version, Redis module version, database type, connection type, logs, or any other information)

  • OS: Debian 11
  • Redis Insight version: 2.58.0
  • Redis database version: Redis server v=7.0.4
  • connection type: cluster
  • The error log we get from the underlying ioredis library
[NestWinston] Debug	10/22/2024, 5:31:39 AM [IoredisRedisConnectionStrategy] Creating ioredis standalone client - {"stack":"[]"}
[NestWinston] Info	10/22/2024, 5:31:39 AM [IoredisRedisConnectionStrategy] Successfully connected to the redis database - {"stack":"[]"}
[NestWinston] Debug	10/22/2024, 5:31:39 AM [IoredisRedisConnectionStrategy] Creating ioredis standalone client - {"stack":"[]"}
[NestWinston] Info	10/22/2024, 5:31:39 AM [IoredisRedisConnectionStrategy] Successfully connected to the redis database - {"stack":"[]"}
[NestWinston] Warn	10/22/2024, 5:31:39 AM [IoredisRedisConnectionStrategy] Server closed the connection. - {"stack":"[]"}
[NestWinston] Error	10/22/2024, 5:31:39 AM [IoredisRedisConnectionStrategy] Failed connection to the redis oss cluster - {"stack":"[ { message: 'Failed to refresh slots cache.' } ]"}
[NestWinston] Error	10/22/2024, 5:31:39 AM [DatabaseFactory] Failed to add oss cluster. - {"stack":"[ { message: 'Failed to refresh slots cache.' } ]"}
[NestWinston] Error	10/22/2024, 5:31:39 AM [DatabaseService] Connection test failed - {"stack":"[\n  {\n    message: 'Could not connect to xxxx:xxxx:xxxx:xxxx:xxxx::x:6379, please check the connection details.'\n  }\n]"}

So I am wondering if it's related to the Redis client setting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions