TypeError: this.subClient.psubscribe is not a function
See original GitHub issueHi,
We’ve just upgraded redis adapter and ioredis to the latest version:
"@socket.io/redis-adapter": "^7.0.0",
"ioredis": "^4.27.6",
We using RedisAdapter extended:
module.exports = class OurOwnRedisAdapter extends RedisAdapter {
constructor(nsp) {
const options = Object.assign({
pubClient,
subClient: pubClient.duplicate(),
requestsTimeout: 1000
}, config.websocket.adapter);
super(nsp, null, options);
}
...
}
Our pubClient is created like this:
const pubClient = new Redis(_.merge(
{
dropBufferSupport: true // see https://github.com/luin/ioredis/wiki/Improve-Performance#dropbuffersupport-option
},
config.redis,
scopedConfig,
options,
reconnectOnError,
));
And now we get this error that is difficult to know why.
uncaughtException {
error: TypeError: this.subClient.psubscribe is not a function
at new RedisAdapter (/node_modules/@socket.io/redis-adapter/dist/index.js:64:24)
at new OurOwnRedisAdapter (/lib/websocket-adapter.js:39:5)
at Namespace._initAdapter (/node_modules/socket.io/dist/namespace.js:40:24)
at Server.adapter (/node_modules/socket.io/dist/index.js:133:17)
at module.exports (/lib/websocket.js:27:6)
at Server.<anonymous> (/server.js:25:16)
at Object.onceWrapper (events.js:421:28)
at Server.emit (events.js:315:20)
at emitListeningNT (net.js:1352:10)
at processTicksAndRejections (internal/process/task_queues.js:79:21)
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
socket.io-redis-adapter with redis 4
Error TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer. Received type function ...
Read more >socket.io-redis
The redis adapter instances expose the following properties that a regular Adapter does not. uid; prefix; pubClient; subClient; requestsTimeout ...
Read more >socket.io-redis
The Redis adapter extends the broadcast function of the in-memory adapter: the ... redis-cli 127.0.0.1:6379> PSUBSCRIBE * Reading messages.
Read more >Redis adapter
io.adapter(createAdapter(pubClient, subClient)); ... Note: with redis@3 , calling connect() on the Redis clients is not needed:.
Read more >"TypeError: require(...).listen is not a function" in socket.io
In this video I have shown " TypeError : require(...).listen is not a function "that you might face with connecting to ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Morbden please check https://github.com/socketio/socket.io-redis-adapter/issues/417
Please also note that
redis@4.0.0
has been released only 20 hours ago 👼Since version
7.0.0
, thepubClient
andsubClient
option must be passed in the list of arguments, and not in the options anymore:Which in your case should give: