0

I'm am getting an error in production that doesn't occur in development. It appears in the stack trace that the gem is using the wrong version of ruby (2.1.0), but I have specified 2.1.3 in my gemfile and followed the heroku troubleshooting on ruby versions. Based on other stackoverflow information the ruby version makes a difference here. Anyone know how to update app/vendor/bundle to the latest?

This is my error which is occurring in a Resque worker...

undefined method `name' for nil:NilClass
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:72:in `block in initialize'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:74:in `yield'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:74:in `block in initialize'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:74:in `yield'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:74:in `block in initialize'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:74:in `yield'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:74:in `block in initialize'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:150:in `yield'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:150:in `accept'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:114:in `push'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych.rb:409:in `dump'
...snip...

This is my ruby version...

heroku run "ruby --version"
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]

This is what's in /app/vendor/bundle...

heroku run "ls /app/vendor/bundle/ruby"
2.1.0

This is my Gemfile ruby declaration....

source 'https://rubygems.org'

group :default do
  # current stable (heroku needs this listed)
  ruby '2.1.3'
  gem 'rails', '4.1.1'
  gem 'redis' # queue mechanism

  gem 'resque', "~> 1.22.0", :require => "resque/server"
  gem 'resque_mailer' # mailer queue
  gem 'resque-scheduler' # job scheduler

  # postgres and database
  gem 'pg' # postgres
  gem 'activerecord-import' # bulk sql insert
  gem 'seed-fu', '~> 2.3' # db seed data

  # APIs
  gem 'bitly'
  gem 'feedjira' # RSS feeds
  gem 'fullcontact'
  gem 'httparty'# rest api client
  gem 'twilio-ruby' # SMS
  gem 'twitter'
  gem 'twitter-text' # convert twitter, links, hashtags and users
  gem 'yahoo-finance', require: 'yahoo_finance'

  # WEB....
  # Use unicorn as the app server
  gem 'unicorn'

  # javascript
  gem 'jquery-rails'
  gem 'uglifier', '>= 1.3.0' # compressor for js assets
  gem 'coffee-rails', '~> 4.0.0'

  # UI/CSS
  gem 'sass-rails', '~> 4.0.0'
  gem 'bootstrap-sass'
  gem 'jquery-ui-rails'
  gem 'jqcloud-rails' # word cloud
  gem 'footable-rails' # mobile responsive table
  gem 'font-awesome-sass'# icons
  gem 'highcharts-rails'

  # rails
  gem 'turbolinks'
  gem 'simple_form'

  # admin interface
  gem 'rails_admin' # models admin interface
  gem "psych", "~> 2.0.5" # needed for rails_admin

  # user authentication
  gem 'devise'
  gem 'domp'
  gem 'omniauth'
  gem 'omniauth-twitter'
  gem 'omniauth-stocktwits', :git => 'https://github.com/jesseyoungmann/omniauth-stocktwits.git'

  # app support
  gem 'bcrypt', '~> 3.1.2' # for active model secure password
  gem 'kaminari', :git => 'https://github.com/musicglue/kaminari.git' # pagination
end


# docs
group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end


# test
group :test do
  gem "capybara"
  gem 'factory_girl_rails'
  gem 'faker'
  gem 'rspec-rails'
  gem 'selenium-webdriver'
  gem 'simplecov', :require => false
  gem 'vcr', '~> 2.8.0'
  gem 'webmock', '~> 1.15.0'
end

# development
group :development do
  gem 'foreigner', '~> 1.6.1' # foreign key generator
  gem 'rails_layout'

  # profilers
  gem 'rack-mini-profiler'
  gem 'ruby-prof'
end

group :production do
  gem 'newrelic_rpm'
  gem 'rails_12factor' # heroku
end

Thanks!

craigq
  • 692
  • 6
  • 7
  • Show your entire gemfile – MrPizzaFace Oct 22 '14 at 23:16
  • I added the whole contents. I did recently rearrange it, so perhaps I did something dumb. – craigq Oct 23 '14 at 13:39
  • possible duplicate of [Why Do Heroku Stack Traces indicate Ruby 1.9.1 is in use?](http://stackoverflow.com/questions/15296990/why-do-heroku-stack-traces-indicate-ruby-1-9-1-is-in-use) – catsby Oct 23 '14 at 15:47

2 Answers2

0

A possible solution is to create a .ruby-version file in the root of your application and simply put 2.1.3 in it, than your app will always use that version in production and development. I had similar issues in the past and this did the trick for me.

Ryan Rebo
  • 1,278
  • 2
  • 13
  • 27
0

Duplicate of this:

Same answer as this:

Community
  • 1
  • 1
catsby
  • 11,276
  • 3
  • 37
  • 37
  • Hmmm...that seems like a confusing convention and I guess my problem lies elsewhere. Thanks. – craigq Oct 23 '14 at 17:16