Server dies instantly, cause unknown
This happened passively, I found this in my error log
/home/ubuntu/node_modules/socket.io/lib/socket.js:503
emit.apply(self, event);
^
TypeError: CreateListFromArrayLike called on non-object
at /home/ubuntu/node_modules/socket.io/lib/socket.js:503:12
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
Handle the issue, provide more information
I have been seeing a bunch of these errors as well
apply
expects event
to be a type of array, if event
is of any other data type, apply
will throw the TypeError. My guess is that event is somewhat null or undefined in this case, probably because decoding data failed and the packet.data
is in ill form. Anyway, we should probably check if event is an array before calling apply
with it as 2nd argument.
I will submit a PR to put a safeguard in place.
I had this issue on a fairly high load server. Was getting a lot of uncaught exceptions. The way I fixed it was to add this line to /node_modules/socket.io/lib/socket.js
if (typeof event !== 'object') return false;
Above line 513, emit.apply(self, event);
This seems to have fixed the issue for now but not sure if it's a good permanent solution.
I'm also experiencing the same issue..
Same issue here, after a migration of my projets to a new workstation, and trying to launch my gulp tasks over a fresh node.js & npm packages installation. I tried other solutions, downgrading node.js to my last machine version, erasing & reinstall of node modules, but only jamesbachini solution works for me
Most helpful comment
I had this issue on a fairly high load server. Was getting a lot of uncaught exceptions. The way I fixed it was to add this line to /node_modules/socket.io/lib/socket.js
if (typeof event !== 'object') return false;
Above line 513, emit.apply(self, event);
This seems to have fixed the issue for now but not sure if it's a good permanent solution.