質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Q&A

0回答

981閲覧

【Rails5】herokuにてデプロイ後、エラーが出てしまいます。

ussu

総合スコア8

Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

0グッド

0クリップ

投稿2019/09/09 11:53

前提・実現したいこと

rails5でアプリケーションを作成しています。
herokuへデプロイしたのですが、
アクセスしてもうまく表示がされず、下記のような表示になります。

どうすればデプロイしたアプリケーションがうまく表示されるのでしょうか?

発生している問題・エラーメッセージ

イメージ説明

###ソースコード

heroku

1app[api]: Starting process with command `rails db:migrate` by user sample@gmail.com 2heroku[run.4116]: Awaiting client 3heroku[run.4116]: Starting process with command `rails db:migrate` 4heroku[run.4116]: State changed from starting to up 5heroku[run.4116]: State changed from up to complete 6heroku[run.4116]: Process exited with status 0 7heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sample.herokuapp.com request_id=76956f5d-5746-45ff-a37d-8efb80a9b614 fwd="220.109.179.38" dyno= connect= service= status=503 bytes= protocol=https 82019-09-08T14:05:20.515155+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sample.herokuapp.com request_id=601c5a4c-808e-4ed5-a3d5-541210d9c793 fwd="220.109.179.38" dyno= connect= service= status=503 bytes= protocol=https 92019-09-08T14:05:20.158166+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sample.herokuapp.com request_id=b49f7f07-e812-4154-9fd8-d49df726018d fwd="220.109.179.38" dyno= connect= service= status=503 bytes= protocol=https 102019-09-08T14:07:22.241475+00:00 app[api]: Starting process with command `rails c` by user sample@gmail.com 112019-09-08T14:07:27.986281+00:00 heroku[run.3888]: State changed from starting to up 122019-09-08T14:07:28.135798+00:00 heroku[run.3888]: Awaiting client 132019-09-08T14:07:28.194322+00:00 heroku[run.3888]: Starting process with command `rails c` 142019-09-08T14:07:35.505646+00:00 heroku[run.3888]: State changed from up to complete 152019-09-08T14:07:35.595136+00:00 heroku[run.3888]: Process exited with status 1 162019-09-08T14:12:50.201765+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sample.herokuapp.com request_id=7300bc95-03f4-4c1f-a7bb-4ce8b41d28fd fwd="220.109.179.38" dyno= connect= service= status=503 bytes= protocol=https 172019-09-08T14:12:50.708490+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sample.herokuapp.com request_id=41f1fad3-6f0f-4165-96cf-a9f8f45dd690 fwd="220.109.179.38" dyno= connect= service= status=503 bytes= protocol=https 182019-09-08T14:13:24.288669+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sample.herokuapp.com request_id=ffee8bd5-bdf0-4461-8631-273288ad09c8 fwd="220.109.179.38" dyno= connect= service= status=503 bytes= protocol=https 192019-09-08T14:13:24.560277+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sample.herokuapp.com request_id=2320d4c7-683f-4a89-a950-c59f667e1bc2 fwd="220.109.179.38" dyno= connect= service= status=503 bytes= protocol=https 20app[api]: Build started by user sample@gmail.com 21heroku[web.1]: State changed from crashed to starting 22app[api]: Release v22 created by user sample@gmail.com 23app[api]: Deploy 944688cc by user sample@gmail.com 24heroku[web.1]: Starting process with command `bin/rails server -p 10080 -e production` 25app[api]: Build succeeded 26heroku[web.1]: State changed from starting to up 27app[api]: Starting process with command `rails db:migrate` by user sample@gmail.com 28heroku[run.8405]: Awaiting client 29heroku[run.8405]: Starting process with command `rails db:migrate` 30heroku[run.8405]: State changed from starting to up 31heroku[run.8405]: State changed from up to complete 32heroku[run.8405]: Process exited with status 0 33app[web.1]: => Booting Puma 34app[web.1]: => Rails 5.2.3 application starting in production 35app[web.1]: => Run `rails server -h` for more startup options 36app[web.1]: Puma starting in single mode... 37app[web.1]: * Version 3.12.1 (ruby 2.5.3-p105), codename: Llamas in Pajamas 38app[web.1]: * Min threads: 5, max threads: 5 39app[web.1]: * Environment: production 40app[web.1]: * Listening on tcp://0.0.0.0:10080 41app[web.1]: Use Ctrl-C to stop 42app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] Started GET "/" for 220.109.179.38 at 2019-09-08 14:22:31 +0000 43app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] Processing by ToppagesController#index as HTML 44app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] User Load (0.9ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 6], ["LIMIT", 1]] 45app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] (1.1ms) SELECT "users"."id" FROM "users" INNER JOIN "relationships" ON "users"."id" = "relationships"."follow_id" WHERE "relationships"."user_id" = $1 [["user_id", 6]] 46app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] Rendering toppages/index.html.erb within layouts/application 47app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] Rendered layouts/_subbar.html.erb (0.5ms) 48app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] Article Load (0.9ms) SELECT "articles".* FROM "articles" WHERE "articles"."user_id" = $1 ORDER BY "articles"."id" DESC [["user_id", 6]] 49app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] ActiveStorage::Attachment Exists (2.2ms) SELECT 1 AS one FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_id" = $1 AND "active_storage_attachments"."record_type" = $2 AND "active_storage_attachments"."name" = $3 LIMIT $4 [["record_id", 5], ["record_type", "Article"], ["name", "images"], ["LIMIT", 1]] 50app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] ActiveStorage::Attachment Load (0.7ms) SELECT "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_id" = $1 AND "active_storage_attachments"."record_type" = $2 AND "active_storage_attachments"."name" = $3 [["record_id", 5], ["record_type", "Article"], ["name", "images"]] 51app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] CACHE User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 6], ["LIMIT", 1]] 52app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] ActiveStorage::Blob Load (1.4ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 LIMIT $2 [["id", 12], ["LIMIT", 1]] 53app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] S3 Storage (46.9ms) Checked if file exists at key: variants/F1rSs3vKTtUm9nYgf2NpseXK/0893aa954fd492f549fc3bf1b9a82518674f60ebeabbb2562d62d8365be62eae (no) 54app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] S3 Storage (10.4ms) Downloaded file from key: F1rSs3vKTtUm9nYgf2NpseXK 55app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] Rendered articles/_articles.html.erb (109.2ms) 56app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] Rendered toppages/index.html.erb within layouts/application (111.3ms) 57app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] Completed 500 Internal Server Error in 197ms (ActiveRecord: 54.7ms) 58app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] 59app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] ActionView::Template::Error (): 60app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] 6: <% if article.images.attached? %> 61app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] 7: <% article.images.each do |image|%> 62app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] 8: <a href="<%= user_article_path(user_id: article.user.id, id: article.id) %>" > 63app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] 9: <span class="article-img"><%= image_tag image.variant(combine_options:{resize:"620x324^",crop:"620x324+0+0",gravity: :center}).processed %></span> 64app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] 10: </a> 65app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] 11: <% end %> 66app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] 12: <% else %> 67app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] 68app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] app/views/articles/_articles.html.erb:9:in `block (2 levels) in _app_views_articles__articles_html_erb__819315621334421026_47221539011480' 69app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] app/views/articles/_articles.html.erb:7:in `block in _app_views_articles__articles_html_erb__819315621334421026_47221539011480' 70app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] app/views/articles/_articles.html.erb:2:in `_app_views_articles__articles_html_erb__819315621334421026_47221539011480' 71app[web.1]: [a30fa29b-1dea-4937-8103-789db90e1f65] app/views/toppages/index.html.erb:4:in `_app_views_toppages_index_html_erb__3870430910175573819_69971395429320' 72heroku[router]: at=info method=GET path="/" host=sample.herokuapp.com request_id=a30fa29b-1dea-4937-8103-789db90e1f65 fwd="220.109.179.38" dyno=web.1 connect=0ms service=202ms status=500 bytes=1827 protocol=https 73heroku[router]: at=info method=GET path="/favicon.ico" host=sample.herokuapp.com request_id=20f2a2a0-cb4a-44d5-9754-04d31be77f15 fwd="220.109.179.38" dyno=web.1 connect=1ms service=1ms status=200 bytes=143 protocol=https

試したこと

当初はデプロイ後、トップページは表示されるものの一部のページは上記エラーが出てしまう状況でした。
調べてはみたものの進展がなく、
$ heroku restart したところ、トップページすら表示されなくなってしまいました。

補足情報(FW/ツールのバージョンなど)

cloud9にて開発
Rails 5.2.3
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]

cloud9では動作します。

$ git commit
$ git push heroku master
$ heroku config:set RAILS_MASTER_KEY=(config/master.keyの中身)
$ heroku run rails db:migrate

までは済んでいます。

どなたかご教示いただけますと幸いです。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問