###環境
Cloud9(テンプレートはRails Tutorialを選択)
Ruby 2.3
Rails 5.0.0.1
GitHub
https://github.com/masarusan24/sample_app
###現象
Ruby on Rails チュートリアルにそって学習を進めていますが、
第5章を終えたあたりから、Herokuへのデプロイ後にサイトを開こうとすると下記エラーになります。
開発環境では問題なく動いている状態です。
####エラーメッセージ
Application error An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.
ログを見てみろというので、$ heroku logs | grep error
してみました
###出力結果
2017-01-12T00:27:38.982656+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=rails-sample.herokuapp.com request_id=0f78723d-3f66-4981-a0ee-37cdfaf15ae7 fwd="219.101.173.94" dyno= connect= service= status=503 bytes= 2017-01-12T00:27:39.654230+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=rails-sample.herokuapp.com request_id=8691ff81-a219-4ad1-bbff-fe6558d49a7c fwd="219.101.173.94" dyno= connect= service= status=503 bytes= 2017-01-12T00:27:43.590984+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=rails-sample.herokuapp.com request_id=c364a710-c78e-4344-9a16-b94a020b1e30 fwd="219.101.173.94" dyno= connect= service= status=503 bytes= 2017-01-12T00:27:44.496417+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=rails-sample.herokuapp.com request_id=e30e89d8-b7df-44e6-8d14-213824fb10cd fwd="219.101.173.94" dyno= connect= service= status=503 bytes= 2017-01-12T04:38:23.969607+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=rails-sample.herokuapp.com request_id=d6d6fa3d-749d-4a0b-aa64-7c590e40d1d7 fwd="219.101.173.94" dyno= connect= service= status=503 bytes= 2017-01-12T04:38:24.738755+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=rails-sample.herokuapp.com request_id=b3d112b2-0f22-45ef-a396-165e5857acb2 fwd="219.101.173.94" dyno= connect= service= status=503 bytes=
WEBプロセスが止まっているかもしれないということで、$ heroku ps:scale web=1
してみたり$ heroku restart
してみたりしましたが、効果なしでした。
ログにはdesc="App crashed"
と出ていますが、アプリ自体が壊れてしまったのでしょうか。。
対処方法ご教示いただけると助かります。
どうぞよろしくお願いいたします。
1/26 追記
第7章に7.5.3 本番環境へのデプロイの項があったのでそこまで進めてみたのですが、状況変わらずでした。
以下デプロイ手順
$ rails test $ git add -A $ git commit -m "Use SSL and the Puma webserver in production" $ git push $ git push heroku $ heroku run rails db:migrate
heroku logsには相変わらずcode=H10 desc="App crashed"
が出ている状況となります。
heroku logs 詳細
2017-01-26T06:53:49.671886+00:00 heroku[web.1]: Process exited with status 1 2017-01-26T06:53:49.689491+00:00 heroku[web.1]: State changed from starting to crashed 2017-01-26T06:53:49.690754+00:00 heroku[web.1]: State changed from crashed to starting 2017-01-26T06:53:52.311557+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb` 2017-01-26T06:53:54.862499+00:00 app[web.1]: Puma starting in single mode... 2017-01-26T06:53:54.862561+00:00 app[web.1]: * Version 3.4.0 (ruby 2.2.6-p396), codename: Owl Bowl Brawl 2017-01-26T06:53:54.862565+00:00 app[web.1]: * Min threads: 5, max threads: 5 2017-01-26T06:53:54.862586+00:00 app[web.1]: * Environment: production 2017-01-26T06:53:56.445348+00:00 app[web.1]: ! Unable to load application: LoadError: No such file to load -- test_helper 2017-01-26T06:53:56.445431+00:00 app[web.1]: bundler: failed to load command: puma (/app/vendor/bundle/ruby/2.2.0/bin/puma) 2017-01-26T06:53:56.445473+00:00 app[web.1]: LoadError: No such file to load -- test_helper 2017-01-26T06:53:56.445477+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require' 2017-01-26T06:53:56.445478+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require' ・・・ 2017-01-26T06:54:04.803456+00:00 heroku[run.2360]: Starting process with command `rails db:migrate` 2017-01-26T06:54:12.716942+00:00 heroku[run.2360]: State changed from up to complete 2017-01-26T06:54:12.696494+00:00 heroku[run.2360]: Process exited with status 0 2017-01-26T06:54:55.533586+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=calm-garden-72176.herokuapp.com request_id=9c05bdaa-3019-4ad9-9afd-41d490c4e340 fwd="219.101.173.94" dyno= connect= service= status=503 bytes= 2017-01-26T06:54:56.293246+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=calm-garden-72176.herokuapp.com request_id=cb47c74e-37b0-4936-9070-0c8d29c8d715 fwd="219.101.173.94" dyno= connect= service= status=503 bytes=
以下の行あたりが怪しいでしょうか。。
test_helperが見つからない?
! Unable to load application: LoadError: No such file to load -- test_helper
test_helper.rbは下記のように記述されていますが、こちらに問題があるでしょうか。
ruby
1ENV['RAILS_ENV'] ||= 'test' 2require File.expand_path('../../config/environment', __FILE__) 3require 'rails/test_help' 4require "minitest/reporters" 5Minitest::Reporters.use! 6 7class ActiveSupport::TestCase 8 fixtures :all 9 include ApplicationHelper 10end
問題点が特定できておらず申し訳ありませんが、アドバイスありましたらお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。