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

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

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

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

Ruby on Rails

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

Q&A

解決済

1回答

401閲覧

Herokuにデプロイ後、動作確認したら正しくアクセスできません。

mame_ptamago

総合スコア8

Heroku

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

Ruby on Rails

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

0グッド

0クリップ

投稿2018/10/03 16:04

<やったこと>
rails でアプリを作ってみた初心者です。最初にpostgresqlを入れてrais newでアプリを作成し、その後herokuにデプロイしました。デプロイは成功し、その後herokuの自分のページ、またはcould9でheroku openとしたのですがApplication errorとでてきます。

そこで、heroku logs --tailやheroku run rails cで原因を調べてみたのですが、エラーの意味がイマイチわかりません。

<やりたいこと>
デプロイしたアプリがちゃんと動作するようにheroku openなどででてきたURLからアクセスできるようにしたい。

以下にheroku run rails cで出てきたエラーを貼ります。最初は、stm_settings= の単なるスペルミスだと思いました。そしてdevelopment.rbのファイルの中に stm_settings= を見つけたので、smtp_settings = と修正したのですがそれだけで反映されるのでしょうか。または、別のファイルなのでしょうか。ご教示よろしくお願いいたします。

/app/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.2.1/lib/action_mailer/base.rb:582:in method_missing': undefined method stm_settings=' for ActionMailer::Base:Class (NoMethodError)
Did you mean? smtp_settings=
smtp_settings
smtp_settings?
test_settings=
from /app/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.2.1/lib/action_mailer/railtie.rb:49:in block (3 levels) in <class:Railtie>' from /app/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.2.1/lib/action_mailer/railtie.rb:49:in each'
from /app/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.2.1/lib/action_mailer/railtie.rb:49:in block (2 levels) in <class:Railtie>' from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in instance_eval'
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in block in execute_hook' from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:62:in with_execution_control'
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:67:in execute_hook' from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:52:in block in run_load_hooks'
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in each' from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in run_load_hooks'
from /app/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.2.1/lib/action_mailer/base.rb:989:in <class:Base>' from /app/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.2.1/lib/action_mailer/base.rb:437:in module:ActionMailer'
from /app/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.2.1/lib/action_mailer/base.rb:12:in <main>' from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in require'
from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in block in require_with_bootsnap_lfi' from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in register'
from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in require_with_bootsnap_lfi' from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in require'
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in block in require' from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in load_dependency'
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in require' from /app/app/mailers/application_mailer.rb:1:in <main>'
from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in require' from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in block in require_with_bootsnap_lfi'
from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in register' from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in require_with_bootsnap_lfi'
from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in require' from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in block in require'
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in load_dependency' from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in require'
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:374:in block in require_or_load' from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:37:in block in load_interlock'
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies/interlock.rb:14:in block in loading' from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/concurrency/share_lock.rb:151:in exclusive'
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies/interlock.rb:13:in loading' from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:37:in load_interlock'
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:352:in require_or_load' from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:46:in block in require_or_load'
from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in allow_bootsnap_retry' from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:45:in require_or_load'
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:330:in depend_on' from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in depend_on'
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:244:in require_dependency' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:478:in block (2 levels) in eager_load!'
from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:477:in each' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:477:in block in eager_load!'
from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:475:in each' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:475:in eager_load!'
from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:356:in eager_load!' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/application/finisher.rb:69:in each'
from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/application/finisher.rb:69:in block in <module:Finisher>' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:32:in instance_exec'
from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:32:in run' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:61:in block in run_initializers'
from /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:228:in block in tsort_each' from /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component'
from /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:431:in each_strongly_connected_component_from' from /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:349:in block in each_strongly_connected_component'
from /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:347:in each' from /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:347:in call'
from /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:347:in each_strongly_connected_component' from /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:226:in tsort_each'
from /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:205:in tsort_each' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:60:in run_initializers'
from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/application.rb:361:in initialize!' from /app/config/environment.rb:5:in <main>'
from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
(後略)

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

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

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

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

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

guest

回答1

0

ベストアンサー

"stm_settings"のスペルミスで間違いないと思うのですが、development.rb以外にもあるかと思います。
(development.rbは通常開発環境のロード時に読まれるため、本番環境であるherokudではconfig/production.rbとconfig/environments/production.rbが読まれます)

"stm_settings"でgrepしてみてはいかがでしょうか?

投稿2018/10/05 05:39

h_daido

総合スコア824

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

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

mame_ptamago

2018/10/06 01:48

h_daido 様、ご回答ありがとうございます。 grep stm_settings でproduction.rbを検索してみたら2箇所も見つかりました。ここを修正して保存、もう一度heroku openをやってみましたが、やはりできずです。 そのため、heroku logs --tail で見てみると以下のようなエラーがありました。エラー部分だけ貼ります。app crashedということは壊してしまったということでしょうか・・・? 2018-10-06T01:21:44.509463+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=shrouded-badlands-62146.herokuapp.com request_id=5f571b98-c7c9-4c50-bef3-ae38a9c038a3 fwd="211.104.212.217" dyno= connect= service= status=503 bytes= protocol=https 2018-10-06T01:21:50.495198+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=shrouded-badlands-62146.herokuapp.com request_id=b31c3788-7c4f-4037-ba86-146347f18e4d fwd="211.104.212.217" dyno= connect= service= status=503 bytes= protocol=https 2018-10-06T01:21:51.337944+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=shrouded-badlands-62146.herokuapp.com request_id=8e075671-73d5-414f-8f82-50caebc9f4fc fwd="211.104.212.217" dyno= connect= service= status=503 bytes= protocol=https 2018-10-06T01:25:58.960503+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=shrouded-badlands-62146.herokuapp.com request_id=3e09e742-11a6-4c6f-8ba1-96fddc1d25c6 fwd="211.104.212.217" dyno= connect= service= status=503 bytes= protocol=https 2018-10-06T01:26:05.798134+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=shrouded-badlands-62146.herokuapp.com request_id=721bf1b1-4005-42fd-a4aa-cabd5bead43a fwd="211.104.212.217" dyno= connect= service= status=503 bytes= protocol=https 2018-10-06T01:26:49.154202+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=shrouded-badlands-62146.herokuapp.com request_id=ee80ff55-2dac-462d-937e-0706333726ad fwd="211.104.212.217" dyno= connect= service= status=503 bytes= protocol=https 2018-10-06T01:26:50.013830+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=shrouded-badlands-62146.herokuapp.com request_id=94c17d27-e173-4599-9341-528017a21a4a fwd="211.104.212.217" dyno= connect= service= status=503 bytes= protocol=https 2018-10-06T01:27:18.913726+00:00 app[api]: Starting process with command `rails c` by user emailaddress@gmail.com 2018-10-06T01:27:23.940484+00:00 heroku[run.5369]: Awaiting client 2018-10-06T01:27:23.961843+00:00 heroku[run.5369]: Starting process with command `rails c` 2018-10-06T01:27:24.078516+00:00 heroku[run.5369]: State changed from starting to up 2018-10-06T01:27:31.811156+00:00 heroku[run.5369]: State changed from up to complete 2018-10-06T01:27:31.795158+00:00 heroku[run.5369]: Process exited with status 1 2018-10-06T01:36:32.671750+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=shrouded-badlands-62146.herokuapp.com request_id=9de28156-5e87-4e27-880d-be0afebd35b0 fwd="211.104.212.217" dyno= connect= service= status=503 bytes= protocol=https 2018-10-06T01:36:33.616363+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=shrouded-badlands-62146.herokuapp.com request_id=6e3a0aeb-3deb-42e0-9080-e944bf4024b3 fwd="211.104.212.217" dyno= connect= service= status=503 bytes= protocol=https
h_daido

2018/10/08 01:15

返信おそくなりまして、失礼しました。 H10:App Crashedはrailsアプリ起動時のコードで実行時エラーが出ているということなので、壊れたとうわけではありませんので、ひとまず、ご安心ください。 おそらく、貼っていただいたコードよりも前にcrashした原因のログがでていると思います。 heroku logs --tail した状態で、heroku restartをかけてみてはいかがでしょうか?対象箇所のエラーログがみれるのでは?と思います。
mame_ptamago

2018/10/13 14:35

h_daido様 コメントありがとうございます。壊れたわけではないということで少し安心しました。 heroku logs --tail をして、その後 heroku restart と入力すればいいのでしょうか。 やってみましたが、同じようなエラーが表示されます。エラーの内容が読み取れません。やり方がまずいのでしょうか・・・? ec2-user:~/environment/app105 (master) $ heroku logs --tail 2018-10-12T12:26:04.206918+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=shrouded-badlands-62146.herokuapp.com request_id=e28d77c3-9881-4bf1-be02-c985db6fda0a fwd="218.146.104.137" dyno= connect= service= status=503 bytes= protocol=https 2018-10-12T12:26:05.774401+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=shrouded-badlands-62146.herokuapp.com request_id=0a8d44eb-3067-41ee-81b5-b820c88588db fwd="218.146.104.137" dyno= connect= service= status=503 bytes= protocol=https 2018-10-13T12:38:55.640139+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=shrouded-badlands-62146.herokuapp.com request_id=133f9b59-abdd-4b88-84a1-9815048f05b3 fwd="220.119.189.95" dyno= connect= service= status=503 bytes= protocol=https 2018-10-13T12:38:57.789936+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=shrouded-badlands-62146.herokuapp.com request_id=229004c8-34fc-4773-98bf-b922881f3dfc fwd="220.119.189.95" dyno= connect= service= status=503 bytes= protocol=https heroku restart
h_daido

2018/10/15 05:06

>heroku logs --tail をして、その後 heroku restart と入力すればいいのでしょうか それであっています! おそらく、 a.heroku restart b. 何かの実行時エラーが発生してh10状態になる c. その後はh10なので上記エラーが表示されている という状況のはずです。b.のタイミングのログがとれれば解消方法みつかるかと。
mame_ptamago

2018/10/22 15:42

h_daido様 丁寧なご回答、ありがとうございました。原因がなにか結局よくわからなかったのですが、あちこち触ってたらなぜか解決してしまいました。「壊れてない」とか「それであっています!」でちょっと安心できました。よくわからないコメントですみませんがとにかく助かりました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問