Token.id undefined crashes server side Erizo

I get this error message in Upstart Erizo.log:

/root/licode_4/erizo_controller/erizoController/models/Channel.js:14
var toSign = token.tokenId + ',' + token.host,
                  ^

TypeError: Cannot read property 'tokenId' of undefined
    at calculateSignature (/root/licode_4/erizo_controller/erizoController/models/Channel.js:14:23)
    at checkSignature (/root/licode_4/erizo_controller/erizoController/models/Channel.js:20:31)
    at Channel.onToken (/root/licode_4/erizo_controller/erizoController/models/Channel.js:67:9)
    at emitTwo (events.js:106:13)
    at Socket.emit (events.js:191:7)
    at /root/licode_4/node_modules/socket.io/lib/socket.js:514:12
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

I run two physically separate servers for my application, an audio server and a video server. The client attaches to both. There is something that a client is doing that crashes both servers at the same time. I have only that message in the log.

I modified Channels.js in the Audio sever as follows:

const checkSignature = (token, key) => {
	 if (!token) return false;
  var calculatedSignature = calculateSignature(token, key);

  if (calculatedSignature !== token.signature) {
    log.info('message: invalid token signature');
    return false;
  } else {
    return true;
  }
}

Adding in that line:

	if (!token) return false;

To test for undefined token. The one server I modified has stayed up and running the other server crashed.

It crashes maybe once or twice a day. Any idea what is happening on Erizo client that could cause this?

I have only run the change for 24 hours… I will update if I have elimated the crash, but I assume somewhere there is a client side that is not happy.

Severs have run now for over 48 hours without and issue with the change mentioned above. Is it possible to get that into the official code build? I am not sure how to do that or how it works. I know there is something wrong on the client side to cause the problem, but it seems like a good idea to make sure the token exists before checking it.
Thanks

I don’t know if is the same issue but maybe my PR can help too

https://github.com/lynckia/licode/pull/1240