Heroku部署错误H10(App崩溃)

bsk*_*ool 124 deployment ruby-on-rails heroku

我有一个RoR应用程序在我的本地计算机上工作,但当我将它发送到heroku时,它崩溃了.错误日志给出错误H10并说:

    2012-11-21T15:26:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.2/lib/new_relic/control/instance_methods.rb:95:in `start_agent'
    2012-11-21T15:26:48+00:00 heroku[web.1]: State changed from starting to crashed
    2012-11-21T15:26:48+00:00 heroku[web.1]: Process exited with status 1
    2012-11-21T15:26:59+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:27:00+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:30:08+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:30:08+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:30:59+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:31:19+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:31:19+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:32:08+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:32:08+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
Run Code Online (Sandbox Code Playgroud)

编辑:

2012-11-22T10:00:58+00:00 app[web.1]: 
2012-11-22T10:00:59+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno=web.1 queue=0 wait=0ms connect=1ms service=26ms status=200 bytes=0
Run Code Online (Sandbox Code Playgroud)

有没有人曾经有这个,并知道可能导致问题的原因是什么?我找不到解决方案.

谢谢.

小智 268

我遇到了同样的错误,应用程序崩溃了heroku(在dev中运行正常)但是heroku上的错误日志没有透露任何线索.我在这个页面上阅读了其他答案,并在看到"重建应用程序"后大汗淋漓.我想也许我可以进入heroku控制台并环顾四周.我做了,甚至控制台崩溃了,但这次它告诉我为什么.这是一个模糊的变量,我忘了在早些时候的故障排除会话中删除.我并不是说你会遇到同样的问题,但是当我试图通过控制台时,我发现了更多信息.希望这可以帮助.

$ heroku run rails console
Run Code Online (Sandbox Code Playgroud)

  • 这是一个很好的答案,当heroku日志缺乏细节时帮助了我.谢谢. (23认同)
  • `heroku restart`帮我识别了我的问题.我的`bin`文件夹丢失了. (11认同)
  • 只是想说,我再次遇到这个问题,谷歌搜索,发现这个答案,看到我对它进行了投票,它再次解决了我的问题.谢谢@ user3721026.如果你看到这个评论,请再次提出答案,因为我不能:P (8认同)
  • 我在python中遇到了同样的问题,但在这里偶然发现了.相当于"$ heroku运行python manage.py shell",它立即显示我出了什么问题. (3认同)

Hun*_*ter 42

我遇到了同样的问题.日志也没有给我任何线索.所以我按比例缩小并缩小了dynos.这解决了我的问题:

heroku ps:scale web=0
Run Code Online (Sandbox Code Playgroud)

等了几秒钟......

heroku ps:scale web=1
Run Code Online (Sandbox Code Playgroud)

  • `heroku restart`是适用于我的解决方案,我猜(在幕后)这是一个类似的技巧.重启将通过停止所有dynos并重新启动来实现. (20认同)
  • AKA"重启":)谢谢! (3认同)

小智 20

$heroku run rails console 
Run Code Online (Sandbox Code Playgroud)

这是最好的选择,因为它会在你的终端中给你一个错误,它会比你的Heroku日志中的'app crashed'错误更加详细.

  • 这是一个答案,实际上是正确的答案.但与上面的http://stackoverflow.com/a/24113266/376680相同 (3认同)

小智 16

$ heroku restart
Run Code Online (Sandbox Code Playgroud)

帮助我让我的dyno再次运行.我是Heroku的新手,但很高兴我现在知道了.


new*_*rts 12

当我在错误的端口上听时,这发生在我身上

我将listen()改为"process.env.PORT",所以:

http.listen((process.env.PORT || 5000), function(){
  console.log('listening on *:5000');
});
Run Code Online (Sandbox Code Playgroud)

代替

http.listen(5000, function(){
  console.log('listening on *:5000');
});
Run Code Online (Sandbox Code Playgroud)


小智 11

今天晚上有同样的问题.这不是一个非常有用的错误,所以我尝试在控制台中运行

heroku run rails c
Run Code Online (Sandbox Code Playgroud)

它失败了,给了我一个更有帮助的错误.我忽略了删除生产中的方法调用.一旦我解决了这个问题,应用程序运行良好.


小智 5

我推到Git解决了这个问题:

git add .
git commit -am "some text"
git push
Run Code Online (Sandbox Code Playgroud)

然后推送到Heroku:

git push heroku
Run Code Online (Sandbox Code Playgroud)

然后在Heroku上rake db:migrate:

heroku run rake db:migrate
Run Code Online (Sandbox Code Playgroud)

  • 我不知道这会有什么影响.但很高兴它对你有用:) (9认同)
  • 这只是因为你有东西要迁移到heroku数据库 (2认同)