Ruby-on-rails Heroku 部署错误 H10(应用程序崩溃)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13496827/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 21:03:13  来源:igfitidea点击:

Heroku deployment error H10 (App crashed)

ruby-on-railsdeploymentheroku

提问by bskool

I have a RoR app working on my local computer, but when I send it to heroku, it crashes. The error log gives an error H10 & says:

我有一个在本地计算机上运行的 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=

Edit:

编辑:

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

Has anyone had this before, and know what might be causing the problem? I cannot find a solution.

有没有人以前有过这种情况,并知道可能导致问题的原因是什么?我找不到解决方案。

Thanks.

谢谢。

回答by ntimba20

I ran into the same error above, app was crashing on heroku (running fine in dev) but error logs on heroku were not revealing any clues. I read other answers on this page and broke out in a sweat after seeing "rebuilding the app." I figured maybe I could get in the heroku console and look around. I did and even the console crashed, but this time it told me why. It was some obscure variable I forgot to delete during a troubleshooting session hours earlier. I am not saying you will run into the same problem, but I found more info when I tried to go through the console. Hope this helps.

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

$ heroku run rails console

回答by Hunter

I was having the same issue. Logs weren't giving me any clues either. So I scaled down and scaled back up the dynos. This solved the problem for me:

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

heroku ps:scale web=0

Waited a few seconds...

等了几秒...

heroku ps:scale web=1

回答by EricSchulz

$heroku run rails console 

This is the best option since it will give you an error in your terminal which will be much more detailed than the 'app crashed' error in your Heroku logs.

这是最好的选择,因为它会在你的终端中给你一个错误,这比你的 Heroku 日志中的“应用程序崩溃”错误要详细得多。

回答by Kyle Kwon

$ heroku restart

helped me get my dyno running again. I'm new to Heroku but glad I know now.

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

回答by newshorts

this happened to me when I was listening on the wrong port

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

I changed my listen() to "process.env.PORT" so:

我将我的 listen() 更改为“process.env.PORT”,因此:

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

instead of

代替

http.listen(5000, function(){
  console.log('listening on *:5000');
});

回答by Gregory

Had same problem this evening. Not a very helpful error so I tried running in the console

今天晚上有同样的问题。不是一个很有帮助的错误,所以我尝试在控制台中运行

heroku run rails c

it failed and gave me a much more helpful error. I had neglected to delete a method call in production. Once I fixed that, the app worked fine.

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

回答by Frank C Jones

I solved this problem by pushing to Git:

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

git add .
git commit -am "some text"
git push

then push to Heroku:

然后推送到 Heroku:

git push heroku

then rake db:migrate on Heroku:

然后在 Heroku 上 rake db:migrate :

heroku run rake db:migrate

回答by Joe Mellin

I managed to not include my .gitignore file -> that breaks heroku. #doh

我设法不包含我的 .gitignore 文件 -> 破坏了 heroku。#doh

Here is a working .gitignore file

这是一个有效的 .gitignore 文件

/.bundle
/vendor/bundle/
/vendor/ruby/


db/*.sqlite3
/db/*.sqlite3-journal
/log/*
/tmp/*


**.war
*.rbc
*.sassc
.redcar/
.sass-cache
/config/config.yml
/config/database.yml
/coverage.data
/coverage/
/db/*.javadb/
/db/*.sqlite3
/doc/api/
/doc/app/
/doc/features.html
/doc/specs.html
/public/cache
/public/stylesheets/compiled
/public/system/*
/spec/tmp/*
/cache
/capybara*
/capybara-*.html
/gems
/specifications
rerun.txt
pickle-email-*.html
.zeus.sock

**.orig

.DS_Store

/nbproject/

.idea

/*.tmproj

**.swp

.env
.powenv

To create a .gitignore file, in terminal navigate to your apps directory and use the following command

要创建 .gitignore 文件,请在终端导航到您的应用程序目录并使用以下命令

touch .gitignore

Then you can open it up in a your text editor and put the above code into it.

然后你可以在你的文本编辑器中打开它并将上面的代码放入其中。

回答by devudilip

In my case i was using ENV variables in my app, but it was not set in heroku config.

在我的例子中,我在我的应用程序中使用了 ENV 变量,但它没有在 heroku 配置中设置。

heroku console gave proper error:

heroku 控制台给出了正确的错误:

heroku console
`validate_options': Missing required arguments: aws_access_key_id, aws_secret_access_key (ArgumentError)

Then set the ENV config

然后设置ENV配置

heroku config:set AWS_ACCESS_KEY_ID='key'

Restart the Heroku

重启 Heroku

heroku restart

it works!!

有用!!

回答by tomb

I was getting this same H10 app crashed error in Heroku. I clicked 'restart all dynos' in the heroku interface, and problem solved.

我在 Heroku 中遇到了同样的 H10 应用程序崩溃错误。我在 heroku 界面中单击了“重新启动所有 dynos”,问题解决了。