Recently, I was building a yelp clone and deploying it to Heroku. I was using Ruby 2.6.0 and Rails 6 to build the application and came across some difficulties.
Some errors you may get while deploying to Heroku using my dependencies and the rails new
command.
(1) Heroku does not support sqlite3
Fix this with the right db/config file for postgresql and removing ‘sqlite3’ from your Gemfile and adding ‘gem ‘pg” to your Gemfile.
Replace your current config file with the following for example:
development:
adapter: postgresql
database: my_database_development
pool: 5
timeout: 5000
test:
adapter: postgresql
database: my_database_test
pool: 5
timeout: 5000
production:
adapter: postgresql
database: my_database_production
pool: 5
timeout: 5000
(2) Bundler 2 is required for Heroku to run the build.
Fix: Upgrade Ruby version from 2.6.0 => 2.6.1 This is done to fix the Bundler 2 install error from Heroku on attempting git push heroku master.
(3) For any resource that does not exist error for your database in your heroku logs —tail
Fix: run heroku run rake db:migrate
.
Congratulations! Your app is now deployed to Heroku!
More Resources: