socketio / socket.io-admin-ui

Admin UI for Socket.IO

Home Page:https://admin.socket.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Null inside socket.data object's field

yarikpetrenko opened this issue · comments

I have middleware that sets socket.data and one of this object properties can be null. When socket.io-admin-ui in development mode it runs registerVerboseListeners function. Which laters calls createProxy function on "connection" event for every filed inside socket.data. Inside createProxy there is a check:

if (typeof obj !== "object") { return obj; }

but typeof null is also "object" so it will pass and will try to init new Proxy with null as target - new Proxy(null, ...) which will throw an error - "TypeError: Cannot create proxy with a non-object as target or handler" or similar.

In my case it also crash whole app when this error occur.