Skip to content

Null inside socket.data object's field #75

@yarikpetrenko

Description

@yarikpetrenko

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions