Skip to content

There is no sSubscribe method on redisClient object when using redis sentinel with node-redis #571

@barisusakli

Description

@barisusakli

[email protected]
@socket.io/[email protected]

When using createSentinel from https://github.com/redis/node-redis/blob/master/docs/sentinel.md, the returned redisClient object doesn't have a sSubsribe/send_command methods. Which causes the checks in utils.js to go into the ioredis/redis@3 branch and crash. Everything works if the redisClient is created with createClient which returns an object with sSubscribe method.

The stacktrace is below.

TypeError: redisClient.send_command is not a function
    at /usr/src/app/node_modules/@socket.io/redis-adapter/dist/util.js:126:25
    at new Promise (<anonymous>)
    at PUBSUB (/usr/src/app/node_modules/@socket.io/redis-adapter/dist/util.js:125:16)
    at RedisAdapter.serverCount (/usr/src/app/node_modules/@socket.io/redis-adapter/dist/index.js:677:34)
    at RedisAdapter.fetchSockets (/usr/src/app/node_modules/@socket.io/redis-adapter/dist/index.js:550:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Sockets.getUidsInRoom (/usr/src/app/src/socket.io/index.js:316:19)
    at async Promise.all (index 5)
    at async Messaging.loadRoom (/usr/src/app/src/messaging/rooms.js:535:84)
    at async chatsController.get (/usr/src/app/src/controllers/accounts/chats.js:59:15)

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