TypeError: this.subClient.psubscribe is not a function
See original GitHub issuepubClient.duplicate()
return object with a property function named pSubscribe (S is uppercase). and at /node_modules/@socket.io/redis-adapter/dist/index.js the property is named psubscribe (S is lowercase).
For now, The issue is fixed by adding property psubscribe (S is lowercase):
const { Server } = require("socket.io");
const { createAdapter } = require("@socket.io/redis-adapter");
const { createClient } = require("redis");
const io = new Server();
const pubClient = createClient({ host: "localhost", port: 6379 });
const subClient = pubClient.duplicate();
subClient.psubscribe = subClient.pSubscribe
Versions:
"redis": "^4.0.0-rc.1",
"@socket.io/redis-adapter": "^7.0.0",
The error was:
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:11 (6 by maintainers)
Top Results From Across the Web
TypeError: this.subClient.psubscribe is not a function #411
Hi, We've just upgraded redis adapter and ioredis to the latest version: "@socket.io/redis-adapter": "^7.0.0", "ioredis": "^4.27.6", ...
Read more >socket.io-redis-adapter with redis 4 - Stack Overflow
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 NPM
The redis adapter instances expose the following properties that a regular Adapter does not. uid; prefix; pubClient; subClient; requestsTimeout ...
Read more >socket.io-redis - npm
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 - Socket.IO
io.adapter(createAdapter(pubClient, subClient)); ... Note: with redis@3 , calling connect() on the Redis clients is not needed:.
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
@djaffer done!
@darrachequesne I think you are right. It might be some patched code I tried to fix the node-redis v4 support. Sorry for the hassle. Thanks!