Charbell
Charbell

Reputation: 25

Heroku rails deployment "at=error code=H10 desc="App crashed"

I am trying to deploy my Rails app on Heroku however I face two h10 errors:

heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" ... dyno= connect= service= status=503 bytes= protocol=https

and

at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" ...  dyno= connect= service= status=503 bytes= protocol=https

As I read in other posts I ran heroku console.

I got this answer:

/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined local variable or method `acts_as_votable' for Comment (call 'Comment.connection' to establish a connection):Class (NameError)

When I am doing a heroku run rake db:migrate, I get this:

rake aborted!
NameError: uninitialized constant ForestLiana`

Here is my Gemfile :

source 'https://rubygems.org'

ruby '2.3.0'

gem 'rails', '4.2.6'

group :development do
  gem 'sqlite3'
end

group :production do
  gem 'pg'
end

gem 'rails_12factor'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'

gem 'jquery-rails'    
gem 'turbolinks'    
gem 'jbuilder', '~> 2.0'    
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bcrypt', '~> 3.1.7'

group :development, :test do
  gem 'byebug'
end

group :development do
  gem 'web-console', '~> 2.0'
  gem 'spring'
  gem 'forest_liana'
  gem 'acts_as_votable', '~> 0.10.0'
end

Is it due to gem version? How can I solve this issue?

Upvotes: 0

Views: 1804

Answers (1)

Holger Just
Holger Just

Reputation: 55778

When deploying code to Heroku, it does not install gems defined in the :development group in your Gemfile since those gems are usually not needed when actually running your application in production.

In your case however, you have added the acts_as_votable gem in the development group. Since your models are relying on it, you should define it outside of any group in your Gemfile so that it is always installed.

When checking your stacktrace, you can see that the acts_as_votable method you call on your Comment class is not available on Heroku. This could give you the hint that the gem adding this method is either not installed or is not loaded somehow.

Upvotes: 2

Related Questions