Weinre在heroku上

我正在尝试在Heroku上设置Weinre ,但是我遇到了一些问题。

我设法构build应用程序,只需使用一个package.json与weinre npm依赖和一个Procfile,看起来像下面

web: node_modules/weinre/weinre --httpPort $PORT 

起初一切似乎工作,客户端显示的用户界面,JS文件加载正常,但debugging不起作用,并没有客户端在服务器端出现。

在查看日志的同时,我意识到每次包含/ ws / target / *或/ ws / client / *的请求都会收到404错误

 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 

这个设置工作本地没有问题。

我也尝试了与--boundHost 0.0.0.0并得到了同样的错误。 当我使用我的heroku应用程序域/子域作为主机我得到weinre: error running server: Error: listen EADDRNOTAVAIL错误

如果需要的话,你可以在github仓库签出源代码

https://github.com/felipesabino/weinre-heroku

编辑:这可能是有关WebSockets不支持Heroku: https : //devcenter.heroku.com/articles/http-routing#websockets

最奇怪的是PhoneGap的weinredebugging页也出现了同样的问题http://debug.phonegap.com/

有人知道如何解决这个问题吗?

我现在在Heroku上运行,但是我记得当我试图让它工作时,这真是一场噩梦。

这是使用2.0.0-pre-H0WVARLU-incubating weinre,所以它可能有点不同,但我所要做的是:

  • 修改weinre本身,我不得不告诉weinre绑定到所有主机,我修改了cli.coffee文件,并将boundHost设置为-all-作为默认值
  • 我赞扬了channelManager.coffeeif remoteAddress检查,因为你进来的地址是通过代理重新映射的,并且从来不匹配
  • 打开详细的debugging,而你实际上并不需要这个运行它使跟踪错误发生的地方变得更容易(以及为什么请求不是路由)

我的Procfile最终变得非常简单,因为我试图尽可能使用weinre作为“native”(请注意,repo 包含weinre,而不是像你这样的模块):

 web: node weinre 

我留下了任何由process.env.PORT处理的端口更改,而不是从Procfile传入

基本上我发现的是,weinre真的不是在代理的背后工作!

看到这个拉请求https://github.com/apache/incubator-cordova-weinre/pull/10

请注意,不需要其他修改,Procfile可以设置选项(就像它应该),Weinre可以用作节点模块。

package.json(包含修复)

 "dependencies" : { "weinre": "https://github.com/downloads/AppGyver/incubator-cordova-weinre/apache-cordova-weinre-2.0.0-pre-H77LBWIW-incubating-bin.tar.gz" }, 

Procfile

 web: node_modules/weinre/weinre --httpPort $PORT --boundHost -all- --debug true --verbose true 
  • 修改weinre本身,我不得不告诉weinre绑定到所有主机,我修改了cli.coffee文件,并将boundHost设置为-all-作为默认值
  • 我赞扬了channelManager.coffee中的if remoteAddress检查,因为你进来的地址是通过代理重新映射的,并且从来不匹配

这两个提示也对appfog有了很大的帮助

你也需要

  • 将weinre重命名为app.js
  • 需要本地咖啡
  • 将cli分配给一个variables并执行直接运行
  • 使用process.env.PORT扩展cli.coffee – > Port