ably-js
ably-js copied to clipboard
Msgpack error (`-845493783 trailing bytes`) on publishing
Customer reports the following error on publishing (payload just text, or null, not a binary) from Ably on an EC2 instance:
13:39:36.067 Ably: WebSocketTransport.onWsData(): Unexpected exception handing channel message: Error: -845493783 trailing bytes
at Object.decode (/home/ubuntu/dev/redacted/node_modules/msgpack-js/msgpack.js:200:47)
at Function.ProtocolMessage.deserialize (/home/ubuntu/dev/redacted/node_modules/ably/common/lib/types/protocolmessage.js:81:54)
at WebSocketTransport.onWsData (/home/ubuntu/dev/redacted/node_modules/ably/common/lib/transport/websockettransport.js:102:43)
at WebSocket.wsConnection.onmessage (/home/ubuntu/dev/redacted/node_modules/ably/common/lib/transport/websockettransport.js:68:50)
at WebSocket.onMessage (/home/ubuntu/dev/redacted/node_modules/ws/lib/EventTarget.js:99:16)
at emitOne (events.js:77:13)
at WebSocket.emit (events.js:169:7)
at Receiver._ultron.on._receiver.onmessage (/home/ubuntu/dev/redacted/node_modules/ws/lib/WebSocket.js:143:47)
at Receiver.dataMessage (/home/ubuntu/dev/redacted/node_modules/ws/lib/Receiver.js:380:14)
at Receiver.getData (/home/ubuntu/dev/redacted/node_modules/ws/lib/Receiver.js:330:12)
using node v8.5.0.
(Customer reports they installed Ably on their computer locally and copied the node_modules to the EC2 instance as it wouldn't install there, which may make a difference, but our msgpack implementation is pure js, so it shouldn't really..)
(I suggested using useBinaryProtocol: false as a workaround to avoid msgPack, customer reports that works for them)
Customer's environment: AWS::EC2 instance type t2.micro Security group inbound rules: 0.0.0.0/0, ::/0 on port 80 and 81 (tested on both) Mapped ElasticIP.
Code:
this._ablyTest = new Ably.Realtime({
key: AblyAPIKey,
clientId: 'server'
});
var channel = this._ablyTest.channels.get('test');
channel.subscribe(function(msg: any){
console.log('Received: ' + JSON.stringify(msg.data));
});
Workaround Solution:
this._ablyTest = new Ably.Realtime({
...
useBinaryProtocol: false // ADD
});