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

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回答

1337閲覧

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/10 02:58

編集2020/08/10 03:18

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.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が反映されます。

問題、原因の特定に必要なファイルやコードがありましたら、ご指摘願います。
追記(8/10 12:20)

$ git push heroku master を実行すると下記のワーニングが発生します。

terminal

1remote: ###### WARNING: 2remote: 3remote: Detecting rails configuration failed 4remote: set HEROKU_DEBUG_RAILS_RUNNER=1 to debug 5remote: 6remote: ###### WARNING: 7remote: 8remote: We detected that some binary dependencies required to 9remote: use all the preview features of Active Storage are not 10remote: present on this system. 11remote: 12remote: For more information please see: 13remote: https://devcenter.heroku.com/articles/active-storage-on-heroku 14remote: 15remote: 16remote: ###### WARNING: 17remote: 18remote: There is a more recent Ruby version available for you to use: 19remote: 20remote: 2.5.8 21remote: 22remote: The latest version will include security and bug fixes. We always recommend 23remote: running the latest version of your minor release. 24remote: 25remote: Please upgrade your Ruby version. 26remote: 27remote: For all available Ruby versions see: 28remote: https://devcenter.heroku.com/articles/ruby-support#supported-runtimes 29remote: 30remote: ###### WARNING: 31remote: 32remote: No Procfile detected, using the default web server. 33remote: We recommend explicitly declaring how to boot your server process via a Procfile. 34remote: https://devcenter.heroku.com/articles/ruby-default-web-server 35remote: 36remote: 37remote: -----> Discovering process types 38remote: Procfile declares types -> (none) 39remote: Default types for buildpack -> console, rake, web 40remote: 41remote: -----> Compressing... 42remote: Done: 80.3M 43remote: -----> Launching... 44remote: Released v9 45remote: https://unsunghero.herokuapp.com/ deployed to Heroku 46remote: 47remote: Verifying deploy... done. 48To https://git.heroku.com/unsunghero.git 49 ec09b30..2ae93d8 master -> master

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

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

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

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

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

gouf

2020/08/10 11:12

「ruby -c [file name]」で構文エラーも含めてチェックができるのですが、該当しそうなファイルは見つかりますか?
guest

回答1

0

自己解決

config/storage.yml が問題。
storage.ymlのamazonの箇所をコメントアウトを外していなかったことが原因。

storageyml

1amazon: 2service: S3 3access_key_id: <%= ENV["AWS_ACCESS_KEY_ID"] %> 4secret_access_key: <%= ENV["AWS_SECRET_ACCESS_KEY"] %> 5region: ap-northeast-1 6bucket: <%= ENV["AWS_BUCKET"] %> 7

投稿2020/08/11 06:34

goffee555

総合スコア6

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問