How to Solve This Trouble to Deploy a Rails App to Heroku

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.

Having Trouble to deploy a Rails App to Heroku

Heroku doesn't support Ruby 2.1.1. Like it says in the errors, you can find which ruby runtimes work here.

Quick look at the Ruby runtimes that work gives: 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1.6, 2.2.2.

Why I get an Error when trying deploy Ruby on Rails app to Heroku?

OK, I solved the problem. Maybe it will help someone in the future:

  • update Ruby version to 2.6.1
  • gem uninstall bundler and install again gem install bundler -v 2.0.2
  • delete Gemfile.lock and bundle install
  • git push heroku master
  • it works :)

Problem deploying Ruby on Rails 7 app on Heroku

heroku config:set is CLI command, you don't need to put this line to your production.rb

If you need to set this env variable to Heroku just execute in your terminal after heroku create command and before deploy

heroku config:set RAILS_MASTER_KEY=`cat config/master.key`

or

heroku config:set RAILS_MASTER_KEY="$(< config/master.key)"

Unable to build and deploy Rails 6.0.4.1 app on heroku - Throws gyp verb cli error

I had a similar problem but resolved by following steps.

  1. Run the following command. heroku buildpacks:add heroku/nodejs --index 1
  2. Update node version from 16.x to 12.16.2 in package.json.

Trouble Deploying Rails App To Heroku

Try ssh-add command, this adds private key identities to the authentication agent.

How do I fix this to deploy Rails app to Heroku?

This is not a deployment issue

From your Heroku logs it seems that you have not defined a route to handle the root path.

ActionController::RoutingError (No route matches [GET] "/"):

If you look at your config/routes.rb file you need to define a controller/action to handle that path.

Something like:

root to: "acontroller#anaction"

or

get "/" => "acontroller#anaction"

Rails during development serves a default page at the root path. If you run the rails app in production this default page will not be shown. You can check this locally by doing rails server -e production and you'll notice that you don't get that same home page but the same page that you get in Heroku.

Heroku deploying. I can't see any error but my application is not working

Run migration for your app heroku run rake db:migrate

Rails app working locally but not deploying to Heroku due to new method definition

This error:

ActiveRecord::RecordNotFound (Couldn't find Booth with 'id'=3):

does not indicate a problem with your code necessarily, but that something in your application is looking for a Booth with id 3, and your database (probably Heroku Postgres or similar) does not have a booth record with id of 3.

If I had to guess, I'd say you probably want to find a booth by it's user id, not a booth that has the same id as the user in session (which is what your method is doing).

Something like :

Booth.find_by_user(session[:user_id])

or similar (my Rails is rusty)



Related Topics



Leave a reply



Submit