socketio / socket.io-admin-ui

Admin UI for Socket.IO
https://admin.socket.io
MIT License
358 stars 95 forks source link

"Error: Could not encode" when set mode "development" #48

Closed qiulang closed 2 years ago

qiulang commented 2 years ago

I notice I only have dashboard and servers menu

after login

I think this is because start my nodejs using "NODE_ENV=production node index.js" so I set mode code specifically in code

instrument(io, {
  auth: {
     ...
  },
  mode: "development"
});

But then server crash with error

Error: Could not encode
 at _encode (/home/express/node_modules/notepack.io/lib/encode.js:256:13)
 at _encode (/home/express/node_modules/notepack.io/lib/encode.js:162:19)
 at _encode (/home/express/node_modules/notepack.io/lib/encode.js:162:19)
 at _encode (/home/express/node_modules/notepack.io/lib/encode.js:246:17)
 at _encode (/home/express/node_modules/notepack.io/lib/encode.js:162:19)
 at Object.encode (/home/express/node_modules/notepack.io/lib/encode.js:261:41)
 at RedisAdapter.broadcast (/home/express/node_modules/socket.io-redis/dist/index.js:313:33)
 at BroadcastOperator.emit (/home/express/node_modules/socket.io/dist/broadcast-operator.js:109:22)
 at Namespace.emit (/home/express/node_modules/socket.io/dist/namespace.js:170:73)
 at Socket.<anonymous> (/home/express/node_modules/@socket.io/admin-ui/dist/index.js:284:36)

I searched this error and found someone else also hit this error

https://bestofvue.com/repo/socketio-socket-io-admin-ui-vuejs-web-sockets (at "7. Error serialising sockets with session stores")

qiulang commented 2 years ago

I saw this issue https://github.com/socketio/socket.io-admin-ui/issues/7 was closed at 0.1.2 but I am using 0.4.0 (and "socket.io-redis": "^6.1.1") and still hit it.

mgarf commented 2 years ago

+1 seeing it myself as well

mgarf commented 2 years ago

Here is my stacktrace (similar to above)

image
aryaman-titan commented 2 years ago

I'm encountering the same issue, only with mode set as "development", otherwise it works great. Is there any workaround available for the same @qiulang @darrachequesne ?

darrachequesne commented 2 years ago

I think I have found the culprit, this should be fixed by https://github.com/socketio/socket.io-admin-ui/commit/6d58a755b4d692970d3f2066903a4d503f334f0a.

I'll publish a new version later today.

aryaman-titan commented 2 years ago

I think I have found the culprit, this should be fixed by 6d58a75.

I'll publish a new version later today.

That's awesome! Waiting for it

darrachequesne commented 2 years ago

Released in 0.5.1. Thanks for your patience :+1:

qiulang commented 2 years ago

@darrachequesne I have verified 0.5.1 worked and I would like turn it into feature request: is it possible to make mode setting a runtime setting, so I can turn it on and off when I need ?

I understand the development mode will be a burden to https://admin.socket.io/ but we will host the Admin UI server ourselves so a runtime setting is more appropriate.

qiulang commented 2 years ago

@darrachequesne 0.5.1 also fixed the issue I raised here https://github.com/darrachequesne/notepack/issues/29