FG
๐Ÿ—„๏ธ Databases

Default disableClientInfo: false causes connection failures with Redis servers < 7.2.x

Freshabout 21 hours ago
Mar 14, 20260 views
Confidence Score54%
54%

Problem

Description Summary Starting from recent versions of ioredis, the default behaviour changed to send client information to Redis servers by setting `disableClientInfo: false` by default. This breaks compatibility with Redis servers older than version 7.2.x, as they don't support the `CLIENT SETINFO` command that ioredis attempts to use. Environment - ioredis version: 5.8.1 - Redis server version: < 5.0 - Node.js version: 20.17.x - Platform: linux Steps to Reproduce 1. Install the latest ioredis version 2. Connect to a Redis server with version < 7.2.x 3. Attempt to perform any Redis operation 4. Connection fails or commands are rejected Expected Behaviour The Redis client should successfully connect to and operate with Redis servers running versions before 7.2.x, maintaining backward compatibility. Actual Behaviour The connection fails because ioredis attempts to execute the `CLIENT SETINFO` command, which is only available in Redis 7.2.0+. This results in errors and broken functionality. Error Messages [code block] Root Cause The `disableClientInfo` option defaults to `false` in newer ioredis versions, causing the client to automatically send client metadata using `CLIENT SETINFO`, which was introduced in Redis 7.2.0. Older Redis servers don't recognise this command and reject it. Workaround Explicitly set `disableClientInfo: true` when creating the Redis client: [code block] Or pin ioredis to a version before this breaking change was introduced. Proposed S

Error Output

error ReplyError: ERR unknown command `client`, with args beginning with: `SETINFO`, `LIB-VER`, `5.8.1`, 

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix โ€“ Awaiting Verification

Set disableClientInfo to true for Redis compatibility

Medium Risk

The default setting of disableClientInfo is false in ioredis version 5.8.1, which causes the client to attempt to use the CLIENT SETINFO command. This command is not supported by Redis servers older than version 7.2.x, leading to connection failures and errors.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Update ioredis client configuration

    Modify the Redis client initialization code to explicitly set the disableClientInfo option to true. This will prevent the client from sending client metadata that is incompatible with older Redis versions.

    javascript
    const Redis = require('ioredis');
    const redis = new Redis({ disableClientInfo: true });
  2. 2

    Test the connection

    After updating the configuration, run a simple command to verify that the connection to the Redis server is successful.

    javascript
    redis.ping().then(result => console.log(result)).catch(err => console.error(err));
  3. 3

    Monitor for errors

    Check the application logs for any error messages related to Redis commands after making the configuration change. Ensure that no 'unknown command' errors are present.

  4. 4

    Consider pinning ioredis version

    If issues persist, consider downgrading ioredis to a version prior to 5.8.1 where the default behavior was compatible with older Redis versions.

    bash
    npm install ioredis@5.7.0

Validation

Confirm that the Redis client can successfully connect and execute commands without errors. The expected output for the ping command should be 'PONG'.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

redisiorediscachebug