【问题标题】:Application Error on Heroku - not specifying the correct port?Heroku 上的应用程序错误 - 未指定正确的端口?
【发布时间】:2018-06-05 10:59:21
【问题描述】:

我无法在 Heroku 上查看我正在运行的应用程序。我收到标准的Application Error 屏幕 -

应用程序发生错误,无法提供您的页面。如果您是应用程序所有者,请查看您的日志以了解详细信息。

Heroku 日志:

2018-06-05T10:50:18.031804+00:00 heroku[web.1]: State changed from starting to crashed
2018-06-05T10:50:22.184406+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=m-k-blog.herokuapp.com request_id=8ba945a9-49a0-4e08-8ec9-2103dd7b207a fwd="174.109.209.147" dyno= connect= service= status=503 bytes= protocol=https
2018-06-05T10:50:25.677788+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=m-k-blog.herokuapp.com request_id=65b41c1d-87a7-40d8-8b09-32c39fb9a4fc fwd="174.109.209.147" dyno= connect= service= status=503 bytes= protocol=https
2018-06-05T10:50:26.459018+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=m-k-blog.herokuapp.com request_id=a660a55b-d00a-477d-8a2b-7b0b7093410e fwd="174.109.209.147" dyno= connect= service= status=503 bytes= protocol=https

我的 procfile 当前包含: web: bundle exec rackup config.ru -p $PORT -E $RACK_ENV

我将其更改为以下内容以查看会发生什么,并且应用程序错误仍然存​​在: web: bundle exec rails server -p $PORT

我认为问题在于它没有获得正确的端口,但我无法在 SO 上找到可行的解决方案。


更新(上午 7 点 10 分):

当我运行 heroku run rails console 时,我会收到以下日志:

/app/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:124:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError)
        from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
         ... 8070 levels...
        from /app/vendor/bundle/ruby/2.4.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from /app/vendor/bundle/ruby/2.4.0/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
        from /app/bin/rails:9:in `require'
        from /app/bin/rails:9:in `<main>'

更新(上午 7 点 17 分): 我在 Heroku 上尝试了Restarting all Dynos,但没有成功。

【问题讨论】:

  • 您在本地开发中使用的 ruby​​ 版本是什么?
  • 我使用的是 ruby​​ 2.3.4p301
  • 尝试使用 ruby 2.4,因为 heroku 正在使用该 ruby​​ 版本。从您的错误来看,这似乎只是一个 ruby​​ 版本错误。
  • 这并不能解决问题。我做了rvm reinstall ruby 2.4rvm use 2.4heroku restart,然后部署。

标签: ruby-on-rails ruby heroku deployment


【解决方案1】:

FixnumBignum 现在已弃用,应该使用 Integer 而不是 Ruby 2.4。我还看到您使用的 rails 4.2.5Ruby 2.4 不兼容。

您需要将您的 rails 版本至少升级到 Rails 4.2.8

参考:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-03-03
    • 1970-01-01
    • 2012-09-10
    • 1970-01-01
    • 2017-06-29
    • 2023-04-04
    • 2021-11-25
    • 1970-01-01
    相关资源
    最近更新 更多