0

I am trying to deploy a simple hello world Rails application to Heroku but am getting an application error. The weird thing is it worked fine for my other Rails application but it doesn't work for this one even though I made the same changes to both, including having the same Gemfile, controller action and root route. It works fine locally but not when I deploy it.

http://calm-oasis-3599.herokuapp.com/

This is the error output when I run heroku run rails console and heroku logs.

enter image description here

enter image description here

enter image description here

Any help with finding out why I am getting this error is greatly appreciated.

Here's my Gemfile.lock:

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.2.4)
      actionpack (= 4.2.4)
      actionview (= 4.2.4)
      activejob (= 4.2.4)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.4)
      actionview (= 4.2.4)
      activesupport (= 4.2.4)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.4)
      activesupport (= 4.2.4)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (4.2.4)
      activesupport (= 4.2.4)
      globalid (>= 0.3.0)
    activemodel (4.2.4)
      activesupport (= 4.2.4)
      builder (~> 3.1)
    activerecord (4.2.4)
      activemodel (= 4.2.4)
      activesupport (= 4.2.4)
      arel (~> 6.0)
    activesupport (4.2.4)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    arel (6.0.3)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    builder (3.2.2)
    byebug (8.2.0)
    coffee-rails (4.1.0)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.10.0)
    debug_inspector (0.0.2)
    erubis (2.7.0)
    execjs (2.6.0)
    globalid (0.3.6)
      activesupport (>= 4.1.0)
    i18n (0.7.0)
    jbuilder (2.3.2)
      activesupport (>= 3.0.0, < 5)
      multi_json (~> 1.2)
    jquery-rails (4.0.5)
      rails-dom-testing (~> 1.0)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    json (1.8.3)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.3)
      mime-types (>= 1.16, < 3)
    mime-types (2.6.2)
    mini_portile (0.6.2)
    minitest (5.8.2)
    multi_json (1.11.2)
    nokogiri (1.6.6.3)
      mini_portile (~> 0.6.0)
    pg (0.17.1)
    rack (1.6.4)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.4)
      actionmailer (= 4.2.4)
      actionpack (= 4.2.4)
      actionview (= 4.2.4)
      activejob (= 4.2.4)
      activemodel (= 4.2.4)
      activerecord (= 4.2.4)
      activesupport (= 4.2.4)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.4)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.7)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.2)
      loofah (~> 2.0)
    rails_12factor (0.0.2)
      rails_serve_static_assets
      rails_stdout_logging
    rails_serve_static_assets (0.0.4)
    rails_stdout_logging (0.0.4)
    railties (4.2.4)
      actionpack (= 4.2.4)
      activesupport (= 4.2.4)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.4.2)
    rdoc (4.2.0)
      json (~> 1.4)
    sass (3.4.19)
    sass-rails (5.0.4)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sdoc (0.4.1)
      json (~> 1.7, >= 1.7.7)
      rdoc (~> 4.0)
    spring (1.4.3)
    sprockets (3.4.0)
      rack (> 1, < 3)
    sprockets-rails (2.3.3)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (>= 2.8, < 4.0)
    sqlite3 (1.3.11)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (2.0.1)
    turbolinks (2.5.3)
      coffee-rails
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (2.7.2)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    web-console (2.2.1)
      activemodel (>= 4.0)
      binding_of_caller (>= 0.7.2)
      railties (>= 4.0)
      sprockets-rails (>= 2.0, < 4.0)

PLATFORMS
  ruby

DEPENDENCIES
  byebug
  coffee-rails (~> 4.1.0)
  jbuilder (~> 2.0)
  jquery-rails
  pg (= 0.17.1)
  rails (= 4.2.4)
  rails_12factor (= 0.0.2)
  sass-rails (~> 5.0)
  sdoc (~> 0.4.0)
  spring
  sqlite3
  turbolinks
  uglifier (>= 1.3.0)
  web-console (~> 2.0)

BUNDLED WITH
   1.10.6

Here's the spring gem file

#!/usr/bin/env ruby

# This file loads spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.

unless defined?(Spring)
  require 'rubygems'
  require 'bundler'

  if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^    (?:  )*spring \((.*?)\)$.*?^$/m))
    Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq }
    gem 'spring', match[1]
    require 'spring/binstub'
  end
end
user3226932
  • 2,042
  • 6
  • 39
  • 76
  • Did you run `bundle` before deploying to Heroku? Also, did you commit any changes made to `Gemfile` and `Gemfile.lock`? – vich Nov 17 '15 at 02:29
  • yes to both of your questions – user3226932 Nov 17 '15 at 02:37
  • It might help to see the contents of your `Gemfile.lock`. Also, for the sake of argument, try deleting `Gemfile.lock`, then running `bundle install`, committing the diff (if there is one) and re-deploying. – pdoherty926 Nov 17 '15 at 03:20
  • Also, try specifying a Ruby version in your `Gemfile`. https://devcenter.heroku.com/articles/ruby-versions – pdoherty926 Nov 17 '15 at 03:25
  • tried both of your suggestions but no luck. I added Gemfile.lock to the post, the thing I'm also confused about is why it says it cannot find the 'spring' gem when it is in the Gemfile.lock – user3226932 Nov 17 '15 at 06:54
  • What are the contents of `bin/spring`? Also, try setting [this](https://devcenter.heroku.com/articles/bundler#specifying-gems-and-groups) Heroku config var: `BUNDLE_WITHOUT="development:test"` and re-deploying. – pdoherty926 Nov 17 '15 at 12:27
  • added contents of bin/spring to the end of the post. setting the Heroku config variable and redeploying still didn't work :( – user3226932 Nov 17 '15 at 19:51
  • 1
    I suspect your binstub is causing this issue. You could try to sort it out at that level by adding a production conditional to prevent that code from being evaluated or as a workaround, simply move `gem 'spring'` to the top-level (i.e. out of the dev/test group). See [this](https://stackoverflow.com/questions/33747990/heroku-doesnt-recognize-spring-gem-even-though-its-listed-in-the-gemfile) question. – pdoherty926 Nov 18 '15 at 01:09
  • keeping the spring gem outside of development and test group works, i guess there's no need to put it in any of those groups? – user3226932 Nov 18 '15 at 04:53
  • It's increasing the size of your slug and you're not using it, so it definitely doesn't belong in Production. I'm not sure what exactly is causing your issue, but I'm pretty sure it's your binstubs. You may want try running something this on your server, `bundle config --delete bin && rake rails:update:bin`. (YMMV! This is destructive.) See [this question](https://stackoverflow.com/questions/23165913/bundler-and-wrong-binstubs), which seems to be the same problem. – pdoherty926 Nov 18 '15 at 17:15
  • are you saying that moving gem 'spring' to the top-level means that the gem will be included in production (even though it's not in the production group), which it shouldn't be since it should be in the development group? – user3226932 Nov 19 '15 at 07:25

1 Answers1

1

You may not need to include spring under test group as seen here

Keep it under the development group alone.

Also the version of spring in your gemlock is 1.4.3 and heroku is complaining about 1.4.2. Maybe you need to explicitly specify a version in your gemfile, delete your Gemfile.lock(which should not always happen), run bundle again, commit your changes and redeploy.