{"id":10398,"library":"ioredis","title":"ioredis","description":"ioredis is a robust, performance-focused, and full-featured Redis client for Node.js, supporting Redis versions 2.6.12 up to the latest. Currently at stable version 5.10.1, the project is in a maintenance phase with contributions being evaluated, but `node-redis` is recommended for new projects. It offers support for Redis Cluster, Sentinel, Streams, Pipelining, Lua scripting, Pub/Sub, and includes official TypeScript declarations.","status":"maintenance","version":"5.10.1","language":"javascript","source_language":"en","source_url":"git://github.com/luin/ioredis","tags":["javascript","redis","cluster","sentinel","pipelining","typescript"],"install":[{"cmd":"npm install ioredis","lang":"bash","label":"npm"},{"cmd":"yarn add ioredis","lang":"bash","label":"yarn"},{"cmd":"pnpm add ioredis","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"wrong":"const Redis = require('ioredis');","symbol":"Redis","correct":"import { Redis } from 'ioredis';"}],"quickstart":{"code":"import { Redis } from 'ioredis';\n\nasync function run() {\n  const redis = new Redis(process.env.REDIS_URL ?? 'redis://localhost:6379');\n\n  try {\n    await redis.set('mykey', 'Hello ioredis!');\n    const value = await redis.get('mykey');\n    console.log(`Retrieved value: ${value}`);\n  } catch (error) {\n    console.error('Redis operation failed:', error);\n  } finally {\n    redis.disconnect();\n  }\n}\n\nrun();","lang":"typescript","description":"Connects to a Redis instance, sets a key-value pair, and retrieves it, demonstrating basic client usage."},"warnings":[{"fix":"Consider `node-redis` for new development to benefit from active maintenance and support for newer Redis features.","message":"For new projects, the `node-redis` library is the recommended JavaScript client, as `ioredis` is currently in a maintenance phase.","severity":"gotcha","affected_versions":">=5.0.0"},{"fix":"Consult the \"Upgrading from v4 to v5\" wiki page at `https://github.com/redis/ioredis/wiki/Upgrading-from-v4-to-v5` before migrating.","message":"Upgrading from v4 to v5 introduced breaking changes. Refer to the official migration guide for details.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"If your application relies on client-side blocking timeouts, ensure they are explicitly configured after upgrading to v5.9.1 or later.","message":"Client-side blocking timeouts (e.g., for `BLPOP`) became opt-in in v5.9.1, changing default behavior.","severity":"gotcha","affected_versions":">=5.9.1"},{"fix":"Explicitly set the `family` option in the Redis client configuration (e.g., `family: 4` or `family: 6`) if a specific IP family is required.","message":"Default IP family selection changed to 0 (IPv4/IPv6 dual-stack preferred) in v5.8.2, which might affect connection behavior in specific network environments.","severity":"gotcha","affected_versions":">=5.8.2"},{"fix":"Ensure your application logic correctly handles individual sharded Pub/Sub re-subscriptions and message delivery, as the behavior has changed from bulk re-subscription.","message":"When using sharded Pub/Sub (`SSUBSCRIBE`), re-subscription after disconnection now happens individually per channel as of v5.8.1.","severity":"gotcha","affected_versions":">=5.8.1"}],"env_vars":null,"last_verified":"2026-04-18T00:00:00.000Z","next_check":"2026-07-17T00:00:00.000Z","problems":[{"fix":"Verify that the Redis server is running and listening on the specified host and port (e.g., `localhost:6379`). Check firewall rules or network configuration.","cause":"The Redis server is not running, is configured to listen on a different address/port, or is not accessible from the application's host.","error":"Error: connect ECONNREFUSED <ip>:<port>"},{"fix":"Check the Redis documentation for command availability and spelling. Ensure your Redis server version supports the command you are trying to use.","cause":"The invoked command is not supported by the connected Redis server version or is misspelled.","error":"ERR unknown command '<command>'"},{"fix":"Refer to the Redis documentation for the specific command to determine the correct syntax and required number of arguments.","cause":"The Redis command was called with an incorrect number of arguments.","error":"ERR Wrong number of arguments for '<command>' command"},{"fix":"Verify the health and reachability of all master nodes in your Redis Cluster. Ensure the `startupNodes` configuration is correct.","cause":"When connecting to a Redis Cluster, the client cannot reach any of the master nodes, indicating a cluster health issue or misconfiguration.","error":"Error: All masters are down: <ip>:<port> <ip>:<port>..."},{"fix":"Ensure the `new Redis()` constructor is correctly called and that any asynchronous setup (like connection events or `await`ing operations) is handled before calling Redis commands.","cause":"This usually indicates that the `Redis` client object was not properly initialized or an asynchronous connection was not `await`ed before attempting to use it.","error":"TypeError: Cannot read properties of undefined (reading 'set')"}],"ecosystem":"npm"}