ghwohg
@ghwohg

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

git cloneからのheroku openまでのエラーについて

課題でgithubに既存しているリポジトリを
git cloneして、heroku createで新しくurlを取得しheroku openしました。

しかし以下のようなエラーが出ました。

発生している問題・エラー

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. You can do this from the Heroku CLI with the command
heroku logs --tail

heroku logs --tailでログを見たところ下記のようなログが出ました。

その中でも
Build failed -- check your build output: https://dashboard.heroku.com/apps/68200cca-88b4-4983-bd88-38b34247c523/activity/builds/de3dd53d-42c4-48f7-bd1a-42441c44851c
に着目して
https://dashboard.heroku.com/apps/68200cca-88b4-4983-bd88-38b34247c523/activity/builds/de3dd53d-42c4-48f7-bd1a-42441c44851c
を開くと
sqlite3.h is missing. Try 'brew install sqlite3',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path
とあったのでbrew install sqlite3を実行して再びheroku openするとまた同じエラーになりました。

エラーの詳細を知ろうと
heroku run consoleをしても
irb(main):001:0>
と出てくるだけでどうしたらいいかわかりません。

例)

2022-09-01T09:02:44.579433+00:00 app[api]: Initial release by user 
2022-09-01T09:02:44.579433+00:00 app[api]: Release v1 created by user 
2022-09-01T09:02:44.749361+00:00 app[api]: Enable Logplex by user 
2022-09-01T09:02:44.749361+00:00 app[api]: Release v2 created by user 
2022-09-01T09:02:53.330934+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/" host=stark-temple-03312.herokuapp.com request_id=370578a3-e2df-484a-96e4-2412835f096a fwd="126.95.114.152" dyno= connect= service= status=502 bytes= protocol=https
2022-09-01T09:02:53.624299+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/favicon.ico" host=stark-temple-03312.herokuapp.com request_id=f73ee92e-f9ff-42a6-8c83-44c0d9091ffb fwd="126.95.114.152" dyno= connect= service= status=502 bytes= protocol=https
2022-09-01T09:03:12.000000+00:00 app[api]: Build started by user 
2022-09-01T09:04:43.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/68200cca-88b4-4983-bd88-38b34247c523/activity/builds/de3dd53d-42c4-48f7-bd1a-42441c44851c
2022-09-01T09:06:23.000000+00:00 app[api]: Build started by user 
2022-09-01T09:09:13.021988+00:00 app[api]: Release v3 created by user 
2022-09-01T09:09:13.021988+00:00 app[api]: Set LANG, RACK_ENV, RAILS_ENV, RAILS_LOG_TO_STDOUT, RAILS_SERVE_STATIC_FILES, SECRET_KEY_BASE config vars by user 
2022-09-01T09:09:14.005500+00:00 app[api]: Running release v4 commands by user 
2022-09-01T09:09:14.005500+00:00 app[api]: Attach DATABASE (@ref:postgresql-adjacent-78243) by user 
2022-09-01T09:09:14.017777+00:00 app[api]: Release v5 created by user 
2022-09-01T09:09:14.017777+00:00 app[api]: @ref:postgresql-adjacent-78243 completed provisioning, setting DATABASE_URL. by user 
2022-09-01T09:09:14.405876+00:00 app[api]: Release v6 created by user 
2022-09-01T09:09:14.405876+00:00 app[api]: Deploy 006d6b46 by user 
2022-09-01T09:09:14.422131+00:00 app[api]: Scaled to console@0:Free rake@0:Free web@1:Free by user 
2022-09-01T09:09:19.000000+00:00 app[api]: Build succeeded
2022-09-01T09:09:20.930634+00:00 heroku[web.1]: Starting process with command `bin/rails server -p ${PORT:-5000} -e production`
2022-09-01T09:09:24.066811+00:00 app[web.1]: => Booting Puma
2022-09-01T09:09:24.066829+00:00 app[web.1]: => Rails 6.1.6.1 application starting in production
2022-09-01T09:09:24.066829+00:00 app[web.1]: => Run `bin/rails server --help` for more startup options
2022-09-01T09:09:25.146529+00:00 app[web.1]: Puma starting in single mode...
2022-09-01T09:09:25.146552+00:00 app[web.1]: * Version 3.12.6 (ruby 3.1.2-p20), codename: Llamas in Pajamas
2022-09-01T09:09:25.146553+00:00 app[web.1]: * Min threads: 5, max threads: 5
2022-09-01T09:09:25.146553+00:00 app[web.1]: * Environment: production
2022-09-01T09:09:25.146554+00:00 app[web.1]: * Daemonizing...
2022-09-01T09:09:25.467316+00:00 heroku[web.1]: Process exited with status 0
2022-09-01T09:09:25.558039+00:00 heroku[web.1]: State changed from starting to crashed
2022-09-01T09:09:25.566067+00:00 heroku[web.1]: State changed from crashed to starting
2022-09-01T09:09:31.655589+00:00 heroku[web.1]: Starting process with command `bin/rails server -p ${PORT:-5000} -e production`
2022-09-01T09:09:34.378772+00:00 app[web.1]: => Booting Puma
2022-09-01T09:09:34.378789+00:00 app[web.1]: => Rails 6.1.6.1 application starting in production
2022-09-01T09:09:34.378790+00:00 app[web.1]: => Run `bin/rails server --help` for more startup options
2022-09-01T09:09:35.388109+00:00 app[web.1]: Puma starting in single mode...
2022-09-01T09:09:35.388138+00:00 app[web.1]: * Version 3.12.6 (ruby 3.1.2-p20), codename: Llamas in Pajamas
2022-09-01T09:09:35.388138+00:00 app[web.1]: * Min threads: 5, max threads: 5
2022-09-01T09:09:35.388138+00:00 app[web.1]: * Environment: production
2022-09-01T09:09:35.388139+00:00 app[web.1]: * Daemonizing...
2022-09-01T09:09:35.529462+00:00 heroku[web.1]: Process exited with status 0
2022-09-01T09:09:35.637307+00:00 heroku[web.1]: State changed from starting to crashed
2022-09-01T09:09:36.564528+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=stark-temple-03312.herokuapp.com request_id=e677ee64-cb3d-4ed7-b3b4-da9423dc6de5 fwd="126.95.114.152" dyno= connect= service= status=503 bytes= protocol=https
2022-09-01T09:09:36.949909+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=stark-temple-03312.herokuapp.com request_id=e9feb231-d9f4-4db1-b922-e45ea66c1229 fwd="126.95.114.152" dyno= connect= service= status=503 bytes= protocol=https
0

1Answer

そのビルドエラーは Release v2 のときに起こったことです。 Release v3 からはビルドに成功しているのでもう関係ありません。

2022-09-01T09:09:35.388139+00:00 app[web.1]: * Daemonizing...
2022-09-01T09:09:35.529462+00:00 heroku[web.1]: Process exited with status 0

この2行の間で app が終了しています。サーバなので本来は実行され続けるはずですが。またクラッシュではなく正常終了しているようです。

アプリケーションコードのエラーではなく、 puma のバージョンが古いか、設定ミスがある気がします。

0Like

Your answer might help someone💌