Pythonとサラリーマンと

2020年6月にPythonを始めたサラリーマンのブログです。

Herokuエラーの解決メモ

Rails TutorialでHerokuにアップしてアプリケーションを起動。 エラーが出て、ログを見ろと言われて困った時の解決メモ。

実施したこと↓

heroku logs --tail

これを叩いても。

2019-03-18T12:49:15.883879+00:00 heroku[web.1]: State changed from starting to crashed
2019-03-18T14:24:59.213090+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sample-app-ttttt.herokuapp.com request_id=fa990677-dc73-4301-af44-3a83ae6ee1cb fwd="220.213.51.139" dyno= connect= service= status=503 bytes= protocol=https
2019-03-18T14:24:59.708742+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sample-app-ttttt.herokuapp.com request_id=bf55bfbd-902b-40d0-8bd7-0413c02792e4 fwd="220.213.51.139" dyno= connect= service= status=503 bytes= protocol=https

とか言われてcrashしたことだけしか分からなかった。

そこで実施したのが以下。

heroku run rails c

これをやると

/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require': /app/app/controllers/password_resets_controller.rb:65: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)

という感じでpassword_resets_controllerが悪そうだぞ!と教えてくれた。 実際に見てみるとtypoを発見。 修正して、再度Herokuにアップしたら無事に起動できました。

なぜheroku run rails cでエラーの内容を教えてくれたのかは謎。