socketio / socket.io-redis-streams-adapter

The Socket.IO adapter based on Redis Streams, allowing to broadcast events between several Socket.IO servers.
https://socket.io/docs/v4/redis-streams-adapter/
MIT License
30 stars 15 forks source link

[Bug] sio:session set causes error with redis-parser #17

Closed Frohrer closed 8 months ago

Frohrer commented 8 months ago

When connectionStateRecovery is enabled and this package sets the sio:session:[id] it writes an [object Object] which causes the following error (I think):

`/usr/src/app/node_modules/redis-parser/lib/parser.js:179 return new ReplyError(string) ^

ReplyError: ERR syntax error at parseError (/usr/src/app/node_modules/redis-parser/lib/parser.js:179:12) at parseType (/usr/src/app/node_modules/redis-parser/lib/parser.js:302:14) { command: { name: 'set', args: [ 'sio:session:d7xFVnVjftZ_22V0AAAC', 'hKNzaWS0RmRRc1Btd2kwYldsdEU0LUFBQUKjcGlktGQ3eEZWblZqZnRaXzIyVjBBQUFDpXJvb21zkbRGZFFzUG13aTBiV2x0RTQtQUFBQqRkYXRhgA==', '[object Object]' ] } }`

Redis logs: +1709950833.110465 [0 172.21.0.6:41444] "set" "sio:session:d7xFVnVjftZ_22V0AAAC" "hKNzaWS0RmRRc1Btd2kwYldsdEU0LUFBQUKjcGlktGQ3eEZWblZqZnRaXzIyVjBBQUFDpXJvb21zkbRGZFFzUG13aTBiV2x0RTQtQUFBQqRkYXRhgA==" "[object Object]"

darrachequesne commented 8 months ago

I think this should be fixed by https://github.com/socketio/socket.io-redis-streams-adapter/commit/78075ec6663f839d80972520d89eca994a09ae8f, included in version 0.2.1. Could you please check?

Frohrer commented 8 months ago

Yes, thank you. This resolves the error.