I am trying to set up Weinre on heroku but I am having some issues.
I manage to build the app, simply by using a package.json with weinre npm dependency and a Procfile that looks like the following
web: node_modules/weinre/weinre --httpPort $PORT
At first everything seems to work, the client shows up the UI, the JS file loads fine, but the debug does not work and no client ever shows up at the server side.
While looking at the logs, I realized that I keep getting 404 errors for every request that contains /ws/target/* or /ws/client/*
2012-05-31T22:37:53+00:00 heroku[router]: GET xxxx.herokuapp.com/target/target-script.js dyno=web.1 queue=0 wait=0ms service=10ms status=200 bytes=190900
2012-05-31T22:37:36+00:00 heroku[router]: GET xxxx.herokuapp.com/ws/target/t-3 dyno=web.1 queue=0 wait=0ms service=3ms status=404 bytes=9
2012-05-31T22:36:39+00:00 heroku[router]: POST xxxx.herokuapp.com/ws/client/c-1 dyno=web.1 queue=0 wait=0ms service=40ms status=404 bytes=9
This setup works localy with no problem.
I also tried the Procilfe with --boundHost 0.0.0.0
and got the same error. when I use my heroku app domain/subdomain as the host I got weinre: error running server: Error: listen EADDRNOTAVAIL
error
If needed, you can checkout the source at the github repo
https://github.com/felipesabino/weinre-heroku
EDIT: It is possible that it is related to WebSockets not being supported on Heroku: https://devcenter.heroku.com/articles/http-routing#websockets
The weirdest thing is that the same issue happens with PhoneGap's weinre debug page as well http://debug.phonegap.com/
Does anybody know how to solve this?
I have weinre running on Heroku at the moment but I remember that when I was trying to get it working it was a real nightmare.
This was using the 2.0.0-pre-H0WVARLU-incubating
of weinre so it may be a bit different but what I had to do was:
cli.coffee
file and I set the boundHost
to -all-
as the defaultif remoteAddress
check in channelManager.coffee
since the address you come in from is remapped through the proxy and was never matchingMy Procfile ended up being very simple as I tried to use weinre as "native" as possible (note the repo contains only weinre, it's not a module like you're doing):
web: node weinre
I left any port changes to be handled by process.env.PORT
, not passed in from the Procfile
Basically what I found was that weinre really isn't designed to work behind a proxy!