Herokuにデプロイ後、下記のエラーが発生します。
前提・したこと
- ローカルでアプリ制作
- Heroku CLIをインストール
terminal
1$ curl -OL https://cli-assets.heroku.com/heroku-linux-x64.tar.gz 2tar zxf heroku-linux-x64.tar.gz && rm -f heroku-linux-x64.tar.gz 3sudo mv heroku /usr/local 4echo 'PATH=/usr/local/heroku/bin:$PATH' >> $HOME/.bash_profile 5source $HOME/.bash_profile > /dev/null
- rails_12factor をGemに追加
Gem
1group :production do 2 gem 'rails_12factor' 3end
- Git経由でアプリケーションを登録
- $ git init
- $ heroku create
- $ heroku addons:add cleardb
- $ heroku config | grep CLEARDB_DATABASE_URL
- 環境変数を変更
出力されたデータベース情報のmysqlの部分をmysql2に変更して、heroku config:setコマンドで設定を上書き
0. $ git add .
0. $ git commit -m "update for upload to heroku"
0. $ git push heroku master
0. こちらを参考にRails+CarrierWave+heroku環境でAWS S3へ画像をアップロードする処理を実行
処理後、更新するとApplication errorが発生。
発生している問題・エラーメッセージ
$ heroku logs --tail (省略) 2020-08-08T07:19:47.840881+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 2020-08-08T07:19:47.840882+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' 2020-08-08T07:19:47.840882+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' 2020-08-08T07:19:47.840884+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require' 2020-08-08T07:19:47.840885+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency' 2020-08-08T07:19:47.840899+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require' 2020-08-08T07:19:47.840899+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:49:in `require_relative' 2020-08-08T07:19:47.840899+00:00 app[web.1]: from config.ru:3:in `block in <main>' 2020-08-08T07:19:47.840901+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval' 2020-08-08T07:19:47.840903+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string' 2020-08-08T07:19:47.840917+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file' 2020-08-08T07:19:47.840918+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file' 2020-08-08T07:19:47.840918+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config' 2020-08-08T07:19:47.840920+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/server.rb:249:in `app' 2020-08-08T07:19:47.840922+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.3/lib/rails/commands/server/server_command.rb:27:in `app' 2020-08-08T07:19:47.840923+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app' 2020-08-08T07:19:47.840938+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/server.rb:312:in `block in start' 2020-08-08T07:19:47.840938+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/server.rb:379:in `handle_profiling' 2020-08-08T07:19:47.840938+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/server.rb:311:in `start' 2020-08-08T07:19:47.840940+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.3/lib/rails/commands/server/server_command.rb:53:in `start' 2020-08-08T07:19:47.840942+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.3/lib/rails/commands/server/server_command.rb:147:in `block in perform' 2020-08-08T07:19:47.840956+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.3/lib/rails/commands/server/server_command.rb:142:in `tap' 2020-08-08T07:19:47.840957+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.3/lib/rails/commands/server/server_command.rb:142:in `perform' 2020-08-08T07:19:47.840957+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run' 2020-08-08T07:19:47.840959+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command' 2020-08-08T07:19:47.840961+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch' 2020-08-08T07:19:47.840962+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.3/lib/rails/command/base.rb:69:in `perform' 2020-08-08T07:19:47.840982+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.3/lib/rails/command.rb:46:in `invoke' 2020-08-08T07:19:47.840983+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.3/lib/rails/commands.rb:18:in `<top (required)>' 2020-08-08T07:19:47.840983+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' 2020-08-08T07:19:47.840984+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' 2020-08-08T07:19:47.840984+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 2020-08-08T07:19:47.840988+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' 2020-08-08T07:19:47.840988+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' 2020-08-08T07:19:47.840991+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require' 2020-08-08T07:19:47.840993+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency' 2020-08-08T07:19:47.840996+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require' 2020-08-08T07:19:47.840998+00:00 app[web.1]: from bin/rails:9:in `<main>' 2020-08-08T07:19:47.897975+00:00 heroku[web.1]: Process exited with status 1 2020-08-08T07:19:47.930753+00:00 heroku[web.1]: State changed from starting to crashed 2020-08-08T07:42:42.316134+00:00 app[api]: Starting process with command `rails console` by user gooooo.y.4.2@icloud.com 2020-08-08T07:42:46.408181+00:00 heroku[run.3524]: Awaiting client 2020-08-08T07:42:46.420227+00:00 heroku[run.3524]: State changed from starting to up 2020-08-08T07:42:46.452181+00:00 heroku[run.3524]: Starting process with command `rails console` 2020-08-08T07:42:53.389723+00:00 heroku[run.3524]: Process exited with status 1 2020-08-08T07:42:53.420224+00:00 heroku[run.3524]: State changed from up to complete 2020-08-08T07:44:04.347030+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=vast-gorge-07575.herokuapp.com request_id=e7fb6888-c6c9-4e6b-a593-6c90fe855433 fwd="122.131.145.36" dyno= connect= service= status=503 bytes= protocol=https 2020-08-08T07:44:04.927751+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=vast-gorge-07575.herokuapp.com request_id=929b44d4-2427-4842-a558-7100907e34d4 fwd="122.131.145.36" dyno= connect= service= status=503 bytes= protocol=https
heroku run console では下記の通りです
82: from bin/rails:9:in `<main>' 81: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require' 80: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency' 79: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require' 78: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' (省略) 3: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval' 2: from /app/vendor/bundle/ruby/2.5.0/gems/activestorage-5.2.4.3/lib/active_storage/engine.rb:95:in `block (2 levels) in <class:Engine>' 1: from /app/vendor/ruby-2.5.1/lib/ruby/2.5.0/erb.rb:876:in `result' /app/vendor/ruby-2.5.1/lib/ruby/2.5.0/erb.rb:876:in `eval': (erb):13: syntax error, unexpected tIDENTIFIER, expecting ')' (SyntaxError) ...mUoOL3oJjcEEFvZURAsrof/7q3oYxsO) ).to_s); _erbout.<< "\n# ... ... ^~~~~~~ (erb):13: syntax error, unexpected ')', expecting end-of-input ...cEEFvZURAsrof/7q3oYxsO) ).to_s); _erbout.<< "\n# region: a... ... ^
「syantax error」と表示されていたので、関連してそうな周辺の文字列を検索すると
「カンマ抜け」ではないかと推測したのですが、場所が特定できませんでした。
試したこと・調べたこと
補足情報(FW/ツールのバージョンなど)
- macOS Catalina 10.15.6
- Rails 5.2.4.3
- ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
- heroku/7.42.5 linux-x64 node-v12.16.2
- AWS Cloud9
.
Cloud9上では問題なく起動します。DB、S3バケット内にもimageが反映されます。
問題、原因の特定に必要なファイルやコードがありましたら、ご指摘願います。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/08/11 06:12