Ruby On Rails Tutorial - Chapter 1 - Error H10 On Heroku Deployment


My app is working locally. I followed the directions regarding Heroku deployment and changing gemfile to:

source ''

gem 'rails',        '5.1.6'
gem 'puma',         '3.9.1'
gem 'sass-rails',   '5.0.6'
gem 'uglifier',     '3.2.0'
gem 'coffee-rails', '4.2.2'
gem 'jquery-rails', '4.3.1'
gem 'turbolinks',   '5.0.1'
gem 'jbuilder',     '2.7.0'

group :development, :test do
  gem 'sqlite3', '1.3.13'
  gem 'byebug',  '9.0.6', platform: :mri

group :development do
  gem 'web-console',           '3.5.1'
  gem 'listen',                '3.1.5'
  gem 'spring',                '2.0.2'
  gem 'spring-watcher-listen', '2.0.1'

group :production do
  gem 'pg', '0.20.0'

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

However, I get the error and when I run “$ heroku run rails console” this is the error message I get:

from /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/connection_specification.rb:185:in spec' /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/connection_specification.rb:188:inrescue 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)

I’m assuming there is something wrong with sqlite3 and I’ve seen the tutorial on Heroku to remove sqlite3 completely in favor of Postgre but I’m not sure if I should do this at this point in the tutorial. Is this ok? I’m going to just move on since it is working locally but if anyone could shed any light I’d be very grateful.


Once you made the change to the Gemfile did you commit the changes to git?


Yes the changes were committed and on GitHub but its a private repository (as per Hartl’s request) so I can’t post it here. Sorry for not mentioning that as I have seen that as a potential solution on StackOverflow.


Then the issue will be in the database.yml file. It’s probably declared that you want to use sqlite3 which isn’t loaded for production because heroku doesn’t support it.

Can you paste the contents of that file please. It’s in the config directory.


Yes I understand that it has sqlite3 set as the default but I was more so curious as to why changing the database wasn’t included in the tutorial. Unless I missed something (which I looked over and don’t think I did), then I’m wondering if the tutorial is incomplete and TOP’s assignment should be updated to include a link to a solution. Unless of course the objective was for me to just look up the error and fix it myself, but I didn’t want to do that in case there was something I missed. But it seems that perhaps Heroku was updated? Because I see this in the chapter:

Note that we’ve also taken this opportunity to arrange for the sqlite3 gem to be included only in a development or test environment (Section 7.1.1), which prevents potential conflicts with the database used by Heroku (Section 1.5).

And that was where we changed the gemfile which was supposed to be the solution for my problem, or at least I would think.


Also I made the repository public so you can see the files:


This definitely isn’t a problem for everyone and I’m not sure why it is happening for you.

In the config/database.yml file change the production line to the following:

  <<: *default
  adapter: postgresql

Remember to git add and commit before pushing to heroku.


Thank you that worked. Not sure what I did wrong.


It happened with me as well. I think this is missing from the book, that when you change production database gem list on Gemfile, you have to change on the config/database.yml as well.

The fix above solves my issue as well. Thanks!