How can I solve this trouble to deploy a Rails App to Heroku?

I am posting solution might be late but can help other.
Solution most people posting asking to upgrade ruby version. Updating ruby version in an application might be time consuming some time.
But with below solution application can deploy without updating ruby version.

Current stack heroku uses is heroku-18, Having image of Ubuntu 18.04. It have minimum supported runtime is ruby 2.4.5, other information here.

To run aplication with below this ruby version you need to downgrade heroku stack for your application.

Open console and run heroku stack you will find.

  cedar-14
  container
  heroku-16
* heroku-18

You need to downgrade to stack which support your ruby version. For ruby 2.3.x you can set heroku-16

heroku stack:set heroku-16

Now if you run heroku stack you will find heroku-16 stack set for your application.

  cedar-14
  container
* heroku-16
  heroku-18

You might get security vulnerability issue on console, Information here.

Try update only sprockets gem to minimum 3.7.2 like:

bundle update sprockets --bundler '3.7.2'

Or you can set :

config.assets.compile = false # Disables security vulnerability

Run git push heroku master. Boom!! Your application deployed successfully.

Leave a Comment