*初学者です。お手柔らかにご教示頂けますと幸いです。
Herokuでアップロードした画像が時間経つと消える問題が発生していたので、記事通りにAmazon S3を登録してプログラムを書いて、Git commitして、heroku openしたらブラウザ上で以下のようなエラー文が表示されました。
Ruby
1Application error 2An error occurred in the application and your page could not be served. 3If you are the application owner, check your logs for details.
(https://アプリ名.herokuapp.com/)
よくわからないエラー文だったので、heroku logsで確認しました。
ログには以下のエラーが繰り返されていました。
Ruby
12018-07-28T03:50:29.821941+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=xxxxxxxxxxxx.com request_id=host=xxxxxxxxxxxx fwd="host=xxxxxxxxxxxx" dyno= connect= service= status=503 bytes= protocol=https 22018-07-28T03:50:35.328051+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=host=xxxxxxxxxxxx.com request_id=xxxxxxxxxxxx fwd="xxxxxxxxxxxx" dyno= connect= service= status=503 bytes= protocol=https 32018-07-28T04:27:52.249864+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=xxxxxxxxxxxx.com request_id=host=xxxxxxxxxxxx fwd="host=xxxxxxxxxxxx" dyno= connect= service= status=503 bytes= protocol=https 42018-07-28T04:27:52.665188+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=host=xxxxxxxxxxxx.com request_id=xxxxxxxxxxxx fwd="xxxxxxxxxxxx" dyno= connect= service= status=503 bytes= protocol=https 52018-07-28T07:32:44.528767+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=xxxxxxxxxxxx.com request_id=host=xxxxxxxxxxxx fwd="host=xxxxxxxxxxxx" dyno= connect= service= status=503 bytes= protocol=httpsheroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=xxxxxxxxxxxx.com request_id=host=xxxxxxxxxxxx fwd="host=xxxxxxxxxxxx" dyno= connect= service= status=503 bytes= protocol=httpsheroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=xxxxxxxxxxxx.com request_id=host=xxxxxxxxxxxx fwd="host=xxxxxxxxxxxx" dyno= connect= service= status=503 bytes= protocol=https 62018-07-28T07:32:44.971320+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=host=xxxxxxxxxxxx.com request_id=xxxxxxxxxxxx fwd="xxxxxxxxxxxx" dyno= connect= service= status=503 bytes= protocol=https 72018-07-28T07:41:04.312419+00:00 app[api]: Starting process with command `bin/rails console` by user XXXXXXXXXXX 82018-07-28T07:41:14.211907+00:00 heroku[run.3441]: Awaiting client 92018-07-28T07:41:14.283555+00:00 heroku[run.3441]: Starting process with command `bin/rails console` 102018-07-28T07:41:14.289348+00:00 heroku[run.3441]: State changed from starting to up 112018-07-28T07:41:26.906739+00:00 heroku[run.3441]: Process exited with status 1 122018-07-28T07:41:26.921985+00:00 heroku[run.3441]: State changed from up to complete 132018-07-28T09:23:25.195336+00:00 app[api]: Starting process with command `bin/rails console` by user XXXXXXXXXXX 142018-07-28T09:23:36.926778+00:00 heroku[run.7888]: State changed from starting to up 152018-07-28T09:23:36.856143+00:00 heroku[run.7888]: Awaiting client 162018-07-28T09:23:36.916641+00:00 heroku[run.7888]: Starting process with command `bin/rails console` 172018-07-28T09:23:49.706539+00:00 heroku[run.7888]: Process exited with status 1 182018-07-28T09:23:49.725755+00:00 heroku[run.7888]: State changed from up to complete 192018-07-28T09:28:45.022500+00:00 app[api]: Starting process with command `rails db:migrate` by user XXXXXXXXXXX 202018-07-28T09:28:55.395241+00:00 heroku[run.1816]: State changed from starting to up 212018-07-28T09:28:55.331343+00:00 heroku[run.1816]: Awaiting client 222018-07-28T09:28:55.567885+00:00 heroku[run.1816]: Starting process with command `rails db:migrate` 232018-07-28T09:29:06.794224+00:00 heroku[run.1816]: Process exited with status 0 242018-07-28T09:29:06.966385+00:00 heroku[run.1816]: State changed from up
こんな感じです。
heroku run consoleをしてみると、以下のようにも表示されてしまいます。
Ruby
1Running console on ⬢ XXXXXXXXXXX... up, run.5382 (Free) 2/app/vendor/bundle/ruby/2.3.0/gems/aws-sigv4-1.0.3/lib/aws-sigv4/signer.rb:517:in `extract_credentials_provider': Cannot load `Rails.config.active_storage.service`: (Aws::Sigv4::Errors::MissingCredentialsError) 3missing credentials, provide credentials with one of the following options: 4 - :access_key_id and :secret_access_key 5 - :credentials 6 - :credentials_provider 7 from /app/vendor/bundle/ruby/2.3.0/gems/aws-sigv4-1.0.3/lib/aws-sigv4/signer.rb:121:in `initialize' 8 from /app/vendor/bundle/ruby/2.3.0/gems/aws-sdk-s3-1.17.0/lib/aws-sdk-s3/plugins/s3_signer.rb:189:in `new' 9 from /app/vendor/bundle/ruby/2.3.0/gems/aws-sdk-s3-1.17.0/lib/aws-sdk-
まとまらない文章で申し訳ございません。
どたなかご教示頂けますと幸いです。
よろしくお願い致します。
出ているエラーは https://teratail.com/questions/48188 と似ているようですね。この感じだと、このエラー行だけを見てもわからないので、残りのログも掲載していただく必要がありそうです。 ちなみに `heroku run rails console` は正常に実行できますか?
類似エラーをご教示頂きありがとうございます。今回で言うとどこの部分を修正すれば良いのか解明することができず、ログの追記および”heroku run rails console”の表示結果も追記致しました。ご確認頂けますと幸いです。。
追記ありがとうございます。なるほどです。詳しくは回答に書いておきますね。
@takahashim ご回答頂きありがとうございます! ご指摘頂いた部分を重点的にみて怪しい部分を直しました! 根本的な確認ミスなのですが、今までプッシュ先を誤ったところにしていたようで行った変更がリモートリポジトリにうまく反映されておりませんでした。別で質問を立てさせて頂くので、プッシュが成功しましたら改めて確認しベストアンサーとさせて頂きます。汗