You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using Admin UI with Acknowledgements breaks with Could not encode error #54
When receiving an event with an acknowledgment callback, I'm seeing a 'Could not encode' error being thrown from within socket.io-redis.
It appears to be caused by the additional timestamp being added here:
socket.onAny((...args) => {
adminNamespace.emit("event_received", nsp.name, socket.id, args, new Date());
});
This is then passed through the Socket IO Broadcast Adapter, and then to the Redis Adapter which serialises all the arguments. When it tries to serialise the callback function, it throws an error since the encode library used doesn't support functions.
Without Admin UI installed, this issue is avoided because the Broadcast Adapter correctly identifies the acknowledgement callback. It does this using this with the following code: const withAck = typeof data[data.length - 1] === "function";
When Admin UI is installed and enabled, the line above doesn't detect the acknowledgement as it is no longer the last argument.
Activity
mzalewski commentedon Sep 23, 2022
Example test which demonstrates issue:
fix: properly track events with acknowledgement
darrachequesne commentedon Oct 7, 2022
This should be fixed by 6d58a75, included in release 0.5.1. Thanks for the detailed report 👍