Heroku Troubleshooting

I’ve pushed my Rails app to Heroku but when I visit the URL I get “We’re sorry, but something went wrong”

I’m confused because the app works on my localhost. Any thoughts?

This is the default HTTP 500 (internal server error) page. There should be a helpful error message in the logs. You can access them with

heroku logs

@mauricelogic

As @joelq pointed, heroku logs is good start.

I used to forget run heroku run rake db:setup, or heroku run rake db:migrate after push to heroku and then app was not working.

Also you should change this for heroku:

# config/environments/production.rb
config.serve_static_assets = true # default is false

Now I’m getting an Application Error. Here is the output from Heroku Logs:

2013-10-14T18:33:12.984796+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:225:in require_dependency' 2013-10-14T18:33:12.984796+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/engine.rb:438:in block in eager_load!’
2013-10-14T18:33:12.984796+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in load_dependency' 2013-10-14T18:33:12.983533+00:00 app[web.1]: Exiting 2013-10-14T18:33:12.984796+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in require’
2013-10-14T18:33:12.984796+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/engine.rb:438:in each' 2013-10-14T18:33:12.984796+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/engine.rb:439:in block (2 levels) in eager_load!’
2013-10-14T18:33:12.984796+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:313:in depend_on' 2013-10-14T18:33:12.984966+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:30:in run’
2013-10-14T18:33:12.984796+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:359:in require_or_load' 2013-10-14T18:33:12.985304+00:00 app[web.1]: from /app/config/environment.rb:5:in <top (required)>’
2013-10-14T18:33:12.985304+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in require' 2013-10-14T18:33:12.984966+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/engine.rb:436:in each’
2013-10-14T18:33:12.984966+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/engine.rb:436:in eager_load!' 2013-10-14T18:33:12.985050+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:55:in block in run_initializers’
2013-10-14T18:33:12.985050+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:54:in each' 2013-10-14T18:33:12.985304+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/application.rb:136:in initialize!’
2013-10-14T18:33:12.985304+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:54:in run_initializers' 2013-10-14T18:33:12.984966+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/application/finisher.rb:53:in block in module:Finisher
2013-10-14T18:33:12.984966+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:30:in instance_exec' 2013-10-14T18:33:12.985304+00:00 app[web.1]: from /app/config.ru:3:in block in ’
2013-10-14T18:33:12.985533+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:304:in wrapped_app' 2013-10-14T18:33:12.985304+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in load_dependency’
2013-10-14T18:33:12.985304+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in require' 2013-10-14T18:33:12.985304+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in block in require’
2013-10-14T18:33:12.985304+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in method_missing' 2013-10-14T18:33:12.985304+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in instance_eval’
2013-10-14T18:33:12.985533+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in initialize' 2013-10-14T18:33:12.985533+00:00 app[web.1]: from /app/config.ru:in new’
2013-10-14T18:33:12.985533+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:40:in parse_file' 2013-10-14T18:33:12.985533+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands/server.rb:46:in app’
2013-10-14T18:33:12.985533+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:200:in app' 2013-10-14T18:33:12.985533+00:00 app[web.1]: from /app/config.ru:in
2013-10-14T18:33:12.985533+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:40:in eval' 2013-10-14T18:33:12.985665+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:50:in <top (required)>’
2013-10-14T18:33:12.985665+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:55:in block in <top (required)>' 2013-10-14T18:33:12.985533+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:254:in start’
2013-10-14T18:33:12.985533+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands/server.rb:70:in start' 2013-10-14T18:33:12.985665+00:00 app[web.1]: from script/rails:6:in
2013-10-14T18:33:12.985665+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:50:in tap' 2013-10-14T18:33:12.985665+00:00 app[web.1]: from script/rails:6:in require’
2013-10-14T18:33:14.258889+00:00 heroku[web.1]: Process exited with status 1
2013-10-14T18:33:14.268315+00:00 heroku[web.1]: State changed from starting to crashed
2013-10-14T18:33:14.269760+00:00 heroku[web.1]: State changed from crashed to starting
2013-10-14T18:33:41.103173+00:00 heroku[web.1]: Starting process with command bundle exec rails server -p 47619
2013-10-14T18:33:46.828547+00:00 app[web.1]: fatal: Not a git repository (or any of the parent directories): .git
2013-10-14T18:33:47.712441+00:00 app[web.1]: fatal: Not a git repository (or any of the parent directories): .git
2013-10-14T18:33:50.766244+00:00 app[web.1]: fatal: Not a git repository (or any of the parent directories): .git
2013-10-14T18:33:59.892507+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: Ruby on Rails — Rails 3.2.0.rc2 has been released!. (called from <top (required)> at /app/config/environment.rb:5)
2013-10-14T18:33:59.917117+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: Ruby on Rails — Rails 3.2.0.rc2 has been released!. (called from <top (required)> at /app/config/environment.rb:5)
2013-10-14T18:33:59.923796+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: Ruby on Rails — Rails 3.2.0.rc2 has been released!. (called from <top (required)> at /app/config/environment.rb:5)
2013-10-14T18:34:03.800992+00:00 app[web.1]: => Booting WEBrick
2013-10-14T18:34:03.800992+00:00 app[web.1]: => Call with -d to detach
2013-10-14T18:34:03.800992+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-10-14T18:34:03.800992+00:00 app[web.1]: Exiting
2013-10-14T18:34:03.800992+00:00 app[web.1]: => Rails 3.2.12 application starting in production on http://0.0.0.0:47619
2013-10-14T18:34:03.804744+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in require': /app/app/controllers/pictures_controller.rb:43: syntax error, unexpected ')', expecting ']' (SyntaxError) 2013-10-14T18:34:03.804744+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in block in require’
2013-10-14T18:34:03.804744+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in load_dependency' 2013-10-14T18:34:03.804744+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:359:in require_or_load’
2013-10-14T18:34:03.804744+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/engine.rb:439:in block (2 levels) in eager_load!' 2013-10-14T18:34:03.804744+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:313:in depend_on’
2013-10-14T18:34:03.804744+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:225:in require_dependency' 2013-10-14T18:34:03.804910+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/engine.rb:436:in eager_load!’
2013-10-14T18:34:03.805097+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/application/finisher.rb:53:in block in <module:Finisher>' 2013-10-14T18:34:03.805097+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:30:in instance_exec’
2013-10-14T18:34:03.804744+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/engine.rb:438:in each' 2013-10-14T18:34:03.805097+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:30:in run’
2013-10-14T18:34:03.805097+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/application.rb:136:in initialize!' 2013-10-14T18:34:03.804744+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in require’
2013-10-14T18:34:03.805097+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:54:in run_initializers' 2013-10-14T18:34:03.805097+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in method_missing’
2013-10-14T18:34:03.805097+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:55:in block in run_initializers' 2013-10-14T18:34:03.804910+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/engine.rb:438:in block in eager_load!’
2013-10-14T18:34:03.805097+00:00 app[web.1]: from /app/config/environment.rb:5:in <top (required)>' 2013-10-14T18:34:03.805233+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in block in require’
2013-10-14T18:34:03.805233+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in require' 2013-10-14T18:34:03.805097+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:54:in each’
2013-10-14T18:34:03.804910+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/engine.rb:436:in each' 2013-10-14T18:34:03.805233+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in initialize’
2013-10-14T18:34:03.805233+00:00 app[web.1]: from /app/config.ru:3:in block in <main>' 2013-10-14T18:34:03.805233+00:00 app[web.1]: from /app/config.ru:in
2013-10-14T18:34:03.805233+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in load_dependency' 2013-10-14T18:34:03.805097+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in require’
2013-10-14T18:34:03.805233+00:00 app[web.1]: from /app/config.ru:in new' 2013-10-14T18:34:03.805233+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:40:in eval’
2013-10-14T18:34:03.805233+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in instance_eval' 2013-10-14T18:34:03.805373+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands/server.rb:46:in app’
2013-10-14T18:34:03.805373+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:254:in start' 2013-10-14T18:34:03.805373+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:200:in app’
2013-10-14T18:34:03.805373+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:304:in wrapped_app' 2013-10-14T18:34:03.805373+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands/server.rb:70:in start’
2013-10-14T18:34:03.805373+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:50:in tap' 2013-10-14T18:34:03.805373+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:55:in block in <top (required)>’
2013-10-14T18:34:03.805233+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:40:in parse_file' 2013-10-14T18:34:03.805373+00:00 app[web.1]: from script/rails:6:in
2013-10-14T18:34:03.805373+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:50:in <top (required)>' 2013-10-14T18:34:03.805373+00:00 app[web.1]: from script/rails:6:in require’
2013-10-14T18:34:06.268561+00:00 heroku[web.1]: State changed from starting to crashed
2013-10-14T18:34:06.249985+00:00 heroku[web.1]: Process exited with status 1
2013-10-14T18:34:07.214666+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path=/ host=shigglez.herokuapp.com fwd=“96.11.164.82” dyno= connect= service= status=503 bytes=

Hopefully someone can help…

What about this line? Can you post that part of the PicturesController?

Also do you have same ruby versions in dev and on Heroku (2.0.0)?

here’s the section from my pictures controller:

def create
@restroom = Restroom.find(params[:restroom_id)
@picture = @restroom.pictures.build(params[:picture])
@picture.user_id = current_user.id

respond_to do |format|
  if @picture.save
    format.html { redirect_to @picture, notice: 'Picture was successfully created.' }
    format.json { render json: @picture, status: :created, location: @picture }
  else
    format.html { render action: "new" }
    format.json { render json: @picture.errors, status: :unprocessable_entity }
  end
end

end
This is line 43: @restroom = Restroom.find(params[:restroom_id)

I am running Ruby 1.9.3p392 on my local server. I don’t know how to check the Ruby version on Heroku. I assumed it was the same.

As it states in log you are missing ].

# change
@restroom = Restroom.find(params[:restroom_id)
# to
@restroom = Restroom.find(params[:restroom_id])

I wonder why it is working on your dev machive.

Also you can see in the log that you are using ruby 2.0.0 on heroku.

1 Like

I’ll try that and give an update. Thanks!

adding the missing ] as @patrikbona stated should solve your issue

as an aside, if you would like to use Ruby version 1.9.3 on Heroku you can add the following line to your Gemfile ruby '1.9.3'

1 Like

Crazy, that DID solve my problem! Thanks for the input fellas. I’ll make the change to my Gemfile as well. Thanks again!