An error has occurred: {“bytesParsed”:0,”code”:”HPE_INVALID_CONSTANT”}

By , Saturday 12th January 2013 2:38 pm

From bdc.co.uk

I’ve been writing a new application in Nodejs, using websockets (socket.io), this application is deployed using the PaaS Nodejitsu.  Everything has been going great and I’ve been surprised how easy it has been to create a realtime application using socket.io. Deployment has also been a breeze with Nodejitsu’s tools.  I develop on a Linux machine myself but the other day I passed the details to someone using a windows machine running internet explorer.  The application stopped working with an error message, a redeploy didn’t help. The error I was presented with was as follows:;

An error has occurred: {“bytesParsed”:0,”code”:”HPE_INVALID_CONSTANT”}

As I haven’t uploaded any new code in about a week I made the incorrect assumption that something had gone wrong on nodejitsu’s side and so dropped them a tweet to let them know as they are still in beta as far as I understand.

Within 90 minutes I’d got a reply from Nuno Job (@dscape) from Nodejitsu letting me know that there was an issue with Internet Explorer, socket.io, and Joyent’s servers. He also included a workaround, and a link with further details. Excellent support!

From what I’ve understood the proxies used at Joyent don’t like non-HTTP response (from the flashsocket) and so prevent any further connections to the domain (please correct me in the comments if incorrect).

The solution is to turn off flashsocket as a transport when configuring socket.io as follows:

var io = require('socket.io').listen(80);

io.configure(function(){
    io.set('transports', [
        'websocket',
        'htmlfile',
        'xhr-polling',
        'jsonp-polling'
    ]);
});

See: https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO

I hope this helps anyone that comes across the same issue, the original solution/explanation came from http://blog.dreamflashstudio.com/2012/08/nodejitsu-on-joyent/.

With this in place the app sprung back into life. I just really need to report to users with browsers that don’t implement websockets that they need to use something more modern…

 

 

 

 

Liked this post? Follow this blog to get more. 

Leave a Reply

You must be logged in to post a comment.

Panorama Theme by Themocracy

3 visitors online now
2 guests, 1 bots, 0 members
Max visitors today: 6 at 04:56 am UTC
This month: 33 at 18-03-2017 08:20 pm UTC
This year: 45 at 02-01-2017 10:28 pm UTC
All time: 130 at 28-03-2011 10:40 pm UTC