LoginSignup
1
0

More than 3 years have passed since last update.

herokuにデプロイ ⇒ Application error

Last updated at Posted at 2021-03-28

エラー内容

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 run rails c

すると下記のエラーが発生。aws_access_key_idとaws_secret_access_keyの記述が怪しそうです。

 Missing required arguments: aws_access_key_id, aws_secret_access_key (ArgumentError)

「rails c」でコンソールを起動し、アクセスキーがちゃんと設定されているかを確認するために下記を実行。

Rails.application.credentials.aws_access_key_id

するとnilが返ってきた。
nilが返ってくるということは、記述が間違っている。

credentialsの値がしっかりと記載されているか確認するために、下記を実行。

EDITOR=vi rails credentials:edit
aws:
#   access_key_id: ********************
#   secret_access_key: ********************
#   region: ********************
#   bucket: ********************
# Used as the base secret for all MessageVerifiers in Rails, including the one protecting cookies.

「#」でコメントアウトされてしまっていた...。
下記に修正する。

aws:
   access_key_id: ********************
   secret_access_key: ********************
   region: ********************
   bucket: ********************
 Used as the base secret for all MessageVerifiers in Rails, including the one protecting cookies.

私はこれで解決しましたが、
access_key_id:と【IAMユーザーのアクセスキーID】の間に半角スペースが一つ入っていない場合なども同様の現象が起きてしまいます。
かなり記述には厳しいらしいのです!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0