前提・実現したいこと
Railsチュートリアル第一章1.5「デプロイする」で、手順書通りに実行し、HerokuのURLにアクセスしたところ、下記のエラーが出てしまいます。
(開発環境であるCloud9上で"Rails server"を起動し、確認した場合は、問題なく"Hello World!"が表示されています)
発生している問題・エラーメッセージ
$ heroku logs 実行で以下のエラーが発生しています。
2018-11-02T03:02:48.162112+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=whispering-earth-68296.herokuapp.com request_id=ae68d43d-a055-45e1-bd0f-3c3e5b00156f fwd="210.160.8.69" dyno= connect= service= status=503 bytes= protocol=https
また、$ heroku logs をさかのぼって見ていくと、以下のerrorが発生していました。
2018-11-02T03:02:43.589214+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/connection_specification.rb:188:in `rescue in spec': Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
また、$ git push heroku master 実行時にbundlerの警告が出ています。
remote: -----> Installing dependencies using bundler 1.15.2 remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment remote: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.6). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
実際のbundlerバージョンは1.17.1なのですが、上記のログでは異なっています。
ec2-user:~/environment/hello_app (master) $ bundle -v Bundler version 1.17.1
その他、$ git push heroku master 実行時にいくつかの警告が出ています。
remote: ###### WARNING: remote: remote: You have not declared a Ruby version in your Gemfile. remote: To set your Ruby version add this line to your Gemfile: remote: ruby '2.4.5' remote: # See https://devcenter.heroku.com/articles/ruby-versions for more information.
remote: ###### WARNING: remote: remote: Detecting rails configuration failed remote: set HEROKU_DEBUG_RAILS_RUNNER=1 to debug
remote: ###### WARNING: remote: remote: No Procfile detected, using the default web server. remote: We recommend explicitly declaring how to boot your server process via a Procfile. remote: https://devcenter.heroku.com/articles/ruby-default-web-server
該当のソースコード
Gemfileは以下の通りです。
Gemfile
1source 'https://rubygems.org' 2 3gem 'rails', '5.1.6' 4gem 'puma', '3.9.1' 5gem 'sass-rails', '5.0.6' 6gem 'uglifier', '3.2.0' 7gem 'coffee-rails', '4.2.2' 8gem 'jquery-rails', '4.3.1' 9gem 'turbolinks', '5.0.1' 10gem 'jbuilder', '2.6.4' 11 12group :development, :test do 13 14 gem 'byebug', '9.0.6', platform: :mri 15 gem 'sqlite3', '1.3.13' 16end 17 18group :development do 19 gem 'web-console', '3.5.1' 20 gem 'listen', '3.1.5' 21 gem 'spring', '2.0.2' 22 gem 'spring-watcher-listen', '2.0.1' 23end 24 25group :production do 26 gem 'pg', '0.20.0' 27end 28 29# Windows環境ではtzinfo-dataというgemを含める必要があります 30gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Gemfile.lockは以下の通りです。
GEM remote: https://rubygems.org/ specs: actioncable (5.1.6) actionpack (= 5.1.6) nio4r (~> 2.0) websocket-driver (~> 0.6.1) actionmailer (5.1.6) actionpack (= 5.1.6) actionview (= 5.1.6) activejob (= 5.1.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) actionpack (5.1.6) actionview (= 5.1.6) activesupport (= 5.1.6) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) actionview (5.1.6) activesupport (= 5.1.6) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) activejob (5.1.6) activesupport (= 5.1.6) globalid (>= 0.3.6) activemodel (5.1.6) activesupport (= 5.1.6) activerecord (5.1.6) activemodel (= 5.1.6) activesupport (= 5.1.6) arel (~> 8.0) activesupport (5.1.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) arel (8.0.0) bindex (0.5.0) builder (3.2.3) byebug (9.0.6) coffee-rails (4.2.2) coffee-script (>= 2.2.0) railties (>= 4.0.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) concurrent-ruby (1.0.5) crass (1.0.4) erubi (1.7.1) execjs (2.7.0) ffi (1.9.25) globalid (0.4.1) activesupport (>= 4.2.0) i18n (1.1.1) concurrent-ruby (~> 1.0) jbuilder (2.6.4) activesupport (>= 3.0.0) multi_json (>= 1.2) jquery-rails (4.3.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) loofah (2.2.3) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) method_source (0.9.0) mini_mime (1.0.1) mini_portile2 (2.3.0) minitest (5.11.3) multi_json (1.13.1) nio4r (2.3.1) nokogiri (1.8.5) mini_portile2 (~> 2.3.0) pg (0.20.0) puma (3.9.1) rack (2.0.5) rack-test (1.1.0) rack (>= 1.0, < 3) rails (5.1.6) actioncable (= 5.1.6) actionmailer (= 5.1.6) actionpack (= 5.1.6) actionview (= 5.1.6) activejob (= 5.1.6) activemodel (= 5.1.6) activerecord (= 5.1.6) activesupport (= 5.1.6) bundler (>= 1.3.0) railties (= 5.1.6) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.0.4) loofah (~> 2.2, >= 2.2.2) railties (5.1.6) actionpack (= 5.1.6) activesupport (= 5.1.6) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (12.3.1) rb-fsevent (0.10.3) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) ruby_dep (1.5.0) sass (3.6.0) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) sass-rails (5.0.6) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) spring (2.0.2) activesupport (>= 4.2) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.13) thor (0.20.0) thread_safe (0.3.6) tilt (2.0.8) turbolinks (5.0.1) turbolinks-source (~> 5) turbolinks-source (5.2.0) tzinfo (1.2.5) thread_safe (~> 0.1) uglifier (3.2.0) execjs (>= 0.3.0, < 3) web-console (3.5.1) actionview (>= 5.0) activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) PLATFORMS ruby DEPENDENCIES byebug (= 9.0.6) coffee-rails (= 4.2.2) jbuilder (= 2.6.4) jquery-rails (= 4.3.1) listen (= 3.1.5) pg (= 0.20.0) puma (= 3.9.1) rails (= 5.1.6) sass-rails (= 5.0.6) spring (= 2.0.2) spring-watcher-listen (= 2.0.1) sqlite3 (= 1.3.13) turbolinks (= 5.0.1) tzinfo-data uglifier (= 3.2.0) web-console (= 3.5.1) BUNDLED WITH 1.17.1
database.ymlは以下の通りです。
# SQLite version 3.x # gem install sqlite3 # # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' # default: &default adapter: sqlite3 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 5000 development: <<: *default database: db/development.sqlite3 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default database: db/test.sqlite3 production: <<: *default adapter: postgresql database: db/production.pg
試したこと
teratailで同様の質問を検索し、数十件試しましたが解決していません。
・Gemfile.lockを削除し、再度 $ bundle update -> $ bundle install を実行
・$ heroku destory [app name] で削除し、再度 $heroku create -> git push heroku master を実行
・$ gem update bundler を実行
補足情報(FW/ツールのバージョンなど)
開発環境:AWS Cloud9
デプロイ環境:Heroku
ソースコード管理:GitHub
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/11/02 08:15
退会済みユーザー
2018/11/02 08:23
2018/11/02 11:53
退会済みユーザー
2018/11/05 00:06
2018/11/05 01:29