きっかけ
久しぶりにデプロイしたアプリを動かすために、herokuサブスクを再契約したら以下のエラーが出た。
エラーの確認方法
コンソールでアプリのルートディレクトリにアクセスし、heroku logs --tails
と入力する。→以下のエラーが表示された。
Error: The following error occurred:
» Missing required flag app
» See more help with --help
コンソールでherokuにログインしていなかったので、heroku login
と入力してherokuにログインする。
再度heroku logs --tails
を入力するが同じエラーになる。
調べて以下のサイトを参考にしながら、gitとherokuを紐づける。
https://qiita.com/hirokik-0076/items/71c104158fa8b963ba85
-
git remote -v
を入力すると、herokuがリポジトリ一覧にない。 -
heroku git:remote -a アプリ名
を入力してgitとherokuを紐づける。 -
heroku config
と入力してアプリが紐づいているか確認する。
上記をやってから再度、heroku logs --tails
を入力すると、以下のログが表示された。
2024-05-31T12:48:09.473391+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=アプリ名.herokuapp.com request_id=xxxxxxxxxxxx fwd="xxxxx" dyno= connect= service= status=503 bytes= protocol=https
原因
Eco Dynos がOnになっていなかった。
herokuのアプリのページで、Recources > Eco Dynos を見るとスイッチがOffになっていた。
スイッチをOnにしてサイトにアクセスするとアプリが動いた。
参考サイト
https://qiita.com/hirokik-0076/items/71c104158fa8b963ba85
https://devcenter.heroku.com/articles/error-codes#h14-no-web-dynos-running