Heroku部署错误H10(应用程序崩溃)

167

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

编辑:

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

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

谢谢。


几个月前遇到了同样的错误。刚开始使用新的HEROKU应用程序,它很有帮助。看起来你在dyno池中有一个损坏的dyno。 - Rustem
不幸的是,这并没有解决我的问题。 - bskool
尝试这个:heroku config:add BUILDPACK_URL=https://github.com/joelcogen/heroku-buildpack-rails-unicorn-nginx - ChuckJHardy
这真的很烦人。特别是因为增加日志级别以包括错误跟踪非常困难。 - max pleaner
遇到了相同的H10错误。在检查日志后,发现是whitenoise的问题,因此我想出了这个解决方案。也许对其他人也有帮助。 - Jakob
显示剩余2条评论
37个回答

0
在node.js中我有同样的问题
解决方法:从项目的.env文件中删除PORT
// app.ts或app.js
const PORT = process.env.PORT || '5000';

// .env

PORT=5000 <--- 注释或删除此行


0
今天我遇到了同样的问题。尽管我之前已经迁移了模型,但我还是运行了heroku run rake db:migrate,应用程序没有崩溃。

0

当我按照他们的指南在Heroku中开始使用Puma时,我遇到了同样的问题。当我注释掉下面显示的端口行时,这个问题得到了解决。

# port        ENV['PORT']     || 3000

所以,在配置目录中的puma.rb文件中禁用上述行解决了该问题

workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup      DefaultRackup
# port        ENV['PORT']     || 3000
environment ENV['RACK_ENV'] || 'production'

on_worker_boot do
  # Worker specific setup for Rails 4.1+
  # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
  ActiveRecord::Base.establish_connection
end

0

我也遇到了同样的错误。将一个.gitignore文件添加到我的项目中解决了我的问题。

我的.gitignore文件在这里:

# Node build artifacts
node_modules
npm-debug.log

# Local development
*.env
*.dev
.DS_Store

# Docker
Dockerfile
docker-compose.yml

我修改了listen()函数;

app.listen(5000, function() {
console.log("Server running on port 5000...");
});

我把它改成了;

    const PORT = process.env.PORT || 5000

...

    app.listen(PORT, function() {
    console.log("Server running on port 5000...");
    });

0

我在我的服务器端应用程序中遇到了同样的问题。默认情况下,浏览器会请求服务器获取favicon.ico。因此,我使用了 serve-favicon 包。这是设置:

import favicon from "serve-favicon";
server.use(favicon(path.join(__dirname, "../assets/images/favicon.ico")));

0

我的意见是,我也遇到了这个问题,并通过以下方式解决:

  • 通过 UI 检查日志,从构建过程的一开始开始检查(例如,在提交后,重新启动 dynos 之后)以查看在崩溃之前发生了什么

  • 当链接模块不包括项目的根目录时(我的问题...)

如此:

const router = require('./logic/router.js') 

改为:

const router = require('../DMS/logic/router.js') 

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接