Fixing "Detected sqlite3 gem which is not supported on Heroku" when deploying Rails to Heroku

Posted on

When I first deployed Rails to Heroku I was greeted with the error:

Failed to install gems via Bundler
Detected sqlite3 gem which is not supported on Heroku:
https://devcenter.heroku.com/articles/sqlite3

The solution is to use postgres instead of sqlite3, which you can do by running:

bundle exec rails db:system:change --to=postgresql

I hope this helps anyone who runs into this error :)