質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Amazon S3

Amazon S3 (Simple Storage Service)とはアマゾン・ウェブ・サービスが提供するオンラインストレージサービスです。

Q&A

解決済

1回答

1203閲覧

Heroku deployは成功するのですが、App crashedというErrorでアプリが開けないです(code=H10) (syntax error)

goffee555

総合スコア6

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Amazon S3

Amazon S3 (Simple Storage Service)とはアマゾン・ウェブ・サービスが提供するオンラインストレージサービスです。

0グッド

0クリップ

投稿2020/08/08 08:56

編集2020/08/09 23:45

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経由でアプリケーションを登録
  1. $ git init
  2. $ heroku create
  3. $ heroku addons:add cleardb
  4. $ heroku config | grep CLEARDB_DATABASE_URL
  5. 環境変数を変更

出力されたデータベース情報の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が反映されます。

問題、原因の特定に必要なファイルやコードがありましたら、ご指摘願います。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

前者のログについてはよくわかりませんが
後者のログについては

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>'

から

activestorage-5.2.4.3/lib/active_storage/engine.rb:95で問題が発生している事がわかるので
config/storage.ymlがERBとしてなにか破綻していることがわかります。


バグで文章がきえていたため修正

投稿2020/08/09 15:17

編集2020/08/10 03:18
asm

総合スコア15147

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

goffee555

2020/08/11 06:12

asm様、ご解答いただきありがとうございました。 おっしゃる通り、config/storage.yml が問題でした。 storage.ymlのamazonの箇所をコメントアウトを外していなかったことが 原因でした。 amazon: service: S3 access_key_id: <%= ENV["AWS_ACCESS_KEY_ID"] %> secret_access_key: <%= ENV["AWS_SECRET_ACCESS_KEY"] %> region: ap-northeast-1 bucket: <%= ENV["AWS_BUCKET"] %> ログの見方が広がり、大変参考になりました。 本当にありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問