2

Upgrading to Mongoid 3 and Ruby 1.9.3. Trying to use Ruby 1.9.3 on Heroku Cedar Stack. I have added the below to the top of my Gemfile:

source 'http://rubygems.org'
ruby "1.9.3"

Pushing to Heroku, it seemed to be working

-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using Bundler version 1.2.0.rc.2

However my app is breaking as it requires Ruby 1.9.3. The error is coming as:

TypeError: can't convert Array into String
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.2.0/lib/moped/node.rb:214:in getaddrinfo'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.2.0/lib/moped/node.rb:214:in
initialize'

My path has bin at the beginning as suggested here

PATH => bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin

Any idea what could be wrong?

UPDATE:

Mongoid.yml

development: 
  sessions: 
    default: 
      database: myapp_development
      hosts: 
        - "localhost:27017"
      max_retries_on_connection_failure: 3
production: 
  sessions: 
    default: 
      database: "<%= ENV['MONGOHQ_DATABASE'] %>"
      hosts: 
        - 
          - "<%= ENV['MONGOHQ_URL1'] %>:<%= ENV['MONGOHQ_PORT'] %>"
        - 
          - "<%= ENV['MONGOHQ_URL2'] %>:<%= ENV['MONGOHQ_PORT'] %>"
      max_retries_on_connection_failure: 10
      password: "<%= ENV['MONGOHQ_PASSWORD'] %>"
      read: !ruby/symbol secondary
      username: "<%= ENV['MONGOHQ_USERNAME'] %>"

Heroku Push Output:

-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using Bundler version 1.2.0.rc.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
       Fetching gem metadata from http://rubygems.org/......
       Fetching gem metadata from http://rubygems.org/..
       Fetching https://github.com/dementrock/sunspot_mongoid.git
       Using rake (0.9.2.2)
       Using log4r (1.1.10)
       Using XMLCanonicalizer (1.0.1)
       Using multi_json (1.0.4)
       Using activesupport (3.1.3)
       Using builder (3.0.0)
       Using i18n (0.6.0)
       Using activemodel (3.1.3)
       Using erubis (2.7.0)
       Using rack (1.3.5)
       Using rack-cache (1.2)
       Using rack-mount (0.8.3)
       Using rack-test (0.6.1)
       Using hike (1.2.1)
       Using tilt (1.3.3)
       Using sprockets (2.0.4)
       Using actionpack (3.1.3)
       Installing mime-types (1.19)
       Using polyglot (0.3.3)
       Using treetop (1.4.10)
       Using mail (2.3.3)
       Using actionmailer (3.1.3)
       Using arel (2.2.3)
       Using tzinfo (0.3.33)
       Using activerecord (3.1.3)
       Using activeresource (3.1.3)
       Using addressable (2.2.8)
       Installing excon (0.15.5)
       Using formatador (0.2.3)
       Using net-ssh (2.5.2)
       Using net-scp (1.0.4)
       Installing nokogiri (1.5.5) with native extensions
       Using ruby-hmac (0.4.0)
       Installing fog (1.5.0)
       Installing asset_sync (0.4.2)
       Installing bson (1.6.4)
       Installing bson_ext (1.6.4) with native extensions
       Using carmen (0.2.7)
       Using carrierwave (0.5.8)
       Installing moped (1.2.0)
       Installing origin (1.0.6)
       Installing mongoid (3.0.4)
       Installing carrierwave-mongoid (0.1.0)
       Installing clockwork (0.4.1)
       Using coffee-script-source (1.3.3)
       Using execjs (1.4.0)
       Using coffee-script (2.2.0)
       Using rack-ssl (1.3.2)
       Installing json (1.7.4) with native extensions
       Using rdoc (3.12)
       Using thor (0.14.6)
       Using railties (3.1.3)
       Using coffee-rails (3.1.1)
       Installing daemons (1.1.9)
       Using delayed_job (3.0.3)
       Using delayed_job_active_record (0.3.2)
       Using eventmachine (0.12.10)
       Using exceptional (2.0.32)
       Using multipart-post (1.1.5)
       Using faraday (0.7.6)
       Using fastercsv (1.5.5)
       Using haml (3.1.6)
       Using jquery-rails (1.0.19)
       Using kaminari (0.13.0)
       Installing systemu (2.5.2)
       Installing macaddr (1.6.1)
       Using net-http-digest_auth (1.2.1)
       Using net-http-persistent (1.9)
       Using webrobots (0.0.13)
       Using mechanize (2.0.1)
       Installing mongo (1.6.4)
       Using mongoid_spacial (0.2.16)
       Using multi_xml (0.4.4)
       Using mysql2 (0.3.11)
       Using net-ldap (0.2.2)
       Installing newrelic_moped (0.0.3)
       Installing newrelic_rpm (3.4.1)
       Using oa-core (0.3.0)
       Using rest-client (1.6.7)
       Using oa-basic (0.3.0)
       Using pyu-ruby-sasl (0.0.3.3)
       Using rubyntlm (0.1.1)
       Using uuid (2.3.5)
       Using oa-enterprise (0.3.0)
       Using oa-more (0.3.0)
       Using oauth (0.4.6)
       Using oauth2 (0.5.2)
       Using oa-oauth (0.3.0)
       Installing ruby-openid (2.2.0)
       Using rack-openid (1.3.1)
       Using ruby-openid-apps-discovery (1.2.0)
       Using oa-openid (0.3.0)
       Using omniauth (0.3.0)
       Installing pg (0.14.0) with native extensions
       Using pr_geohash (1.0.0)
       Using bundler (1.2.0.rc.2)
       Using rails (3.1.3)
       Using recaptcha (0.3.4)
       Using rmagick (2.13.1)
       Using rpm_contrib (2.1.11)
       Using rsolr (1.0.8)
       Using ruby-prof (0.11.2)
       Installing sass (3.2.0)
       Using sass-rails (3.1.4)
       Using sitemap_generator (2.1.8)
       Installing sunspot (1.3.3)
       Installing sunspot_rails (1.3.3)
       Using sunspot_mongoid (0.4.1) from https://github.com/dementrock/sunspot_mongoid.git (at master)
       Installing thin (1.4.1) with native extensions
       Using typhoeus (0.3.3)
       Using uglifier (1.2.4)
       Using validatable (1.6.7)
       Your bundle is complete! It was installed into ./vendor/bundle
       Post-install message from newrelic_rpm:
       PLEASE NOTE:
       Developer Mode is now a Rack middleware.
       Developer Mode is no longer available in Rails 2.1 and earlier.
       However, starting in version 2.12 you can use Developer Mode in any
       Rack based framework, in addition to Rails.  To install developer mode
       in a non-Rails application, just add NewRelic::Rack::DeveloperMode to
       your middleware stack.
       If you are using JRuby, we recommend using at least version 1.4 or
       later because of issues with the implementation of the timeout library.
       Refer to the README.md file for more information.
       Please see http://github.com/newrelic/rpm/blob/master/CHANGELOG
       for a complete description of the features and enhancements available
       in version 3.4 of the Ruby Agent.

       Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
       Detected manifest.yml, assuming assets were compiled locally
-----> Rails plugin injection
       Injecting rails_log_stdout
       Injecting rails3_serve_static_assets
-----> Discovering process types
       Procfile declares types      -> clock, web, worker
       Default types for Ruby/Rails -> console, rake
-----> Compiled slug size is 36.3MB
-----> Launching... done, v318
-----> Deploy hooks scheduled, check output in your logs
       http://myapp.herokuapp.com deployed to Heroku

The server logs:

/app/vendor/bundle/ruby/1.9.1/gems/moped-1.2.0/lib/moped/node.rb:214:in getaddrinfo' /app/vendor/bundle/ruby/1.9.1/gems/moped-1.2.0/lib/moped/node.rb:214:in initialize' /app/vendor/bundle/ruby/1.9.1/gems/moped-1.2.0/lib/moped/cluster.rb:53:in new' /app/vendor/bundle/ruby/1.9.1/gems/moped-1.2.0/lib/moped/cluster.rb:53:in block in initialize' /app/vendor/bundle/ruby/1.9.1/gems/moped-1.2.0/lib/moped/cluster.rb:53:in map' /app/vendor/bundle/ruby/1.9.1/gems/moped-1.2.0/lib/moped/cluster.rb:53:in initialize' /app/vendor/bundle/ruby/1.9.1/gems/moped-1.2.0/lib/moped/session.rb:183:in new' /app/vendor/bundle/ruby/1.9.1/gems/moped-1.2.0/lib/moped/session.rb:183:in initialize' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/mongoid/sessions/factory.rb:64:in new' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/mongoid/sessions/factory.rb:64:in create_session' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/mongoid/sessions/factory.rb:43:in default' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/mongoid/sessions.rb:109:in default' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/mongoid/sessions.rb:378:in __session__' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/mongoid/sessions.rb:213:in mongo_session' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/mongoid/sessions.rb:157:in collection' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/mongoid/contextual/mongo.rb:217:in initialize' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/mongoid/contextual.rb:47:in new' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/mongoid/contextual.rb:47:in create_context' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/mongoid/contextual.rb:30:in context' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/mongoid/contextual.rb:18:in distinct' /app/app/controllers/my_controller.rb:14:in index' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/implicit_render.rb:4:in send_action' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/base.rb:167:in process_action' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/rendering.rb:10:in process_action' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/callbacks.rb:18:in block in process_action' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:436:in run_647889395514353966__process_action_2178726499830545563_callbacks' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in __run_callback' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:385:in _run_process_action_callbacks' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81:in run_callbacks' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/callbacks.rb:17:inprocess_action' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/rescue.rb:29:in process_action' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/instrumentation.rb:30:in block in process_action' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in block in instrument' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications/instrumenter.rb:20:in instrument' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in instrument' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/instrumentation.rb:29:in process_action' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/params_wrapper.rb:205:in process_action' /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.3/lib/active_record/railties/controller_runtime.rb:18:in process_action' /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:34:in block in process_action' /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:262:in block in perform_action_with_newrelic_trace' /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:242:in trace_execution_scoped' /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:257:in perform_action_with_newrelic_trace' /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:33:in process_action' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/base.rb:121:in process' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/rendering.rb:45:in process' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal.rb:203:in dispatch' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/rack_delegation.rb:14:in dispatch' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal.rb:246:in block in action' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:73:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:73:in dispatch' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:36:in call' /app/vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:68:in block in call' /app/vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in each' /app/vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:600:in call' /app/vendor/bundle/ruby/1.9.1/gems/omniauth-1.0.3/lib/omniauth/strategy.rb:168:in call!' /app/vendor/bundle/ruby/1.9.1/gems/omniauth-1.0.3/lib/omniauth/strategy.rb:148:in call' /app/vendor/bundle/ruby/1.9.1/gems/omniauth-1.0.3/lib/omniauth/builder.rb:42:in call' /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/rack/browser_monitoring.rb:12:in call' /app/vendor/bundle/ruby/1.9.1/gems/exceptional-2.0.32/lib/exceptional/integration/rack_rails.rb:13:in call' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/rack/mongoid/middleware/identity_map.rb:33:in block in call' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/mongoid/unit_of_work.rb:39:in unit_of_work' /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.4/lib/rack/mongoid/middleware/identity_map.rb:33:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/best_standards_support.rb:17:in call' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/etag.rb:23:in call' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/conditionalget.rb:25:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/head.rb:14:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/params_parser.rb:21:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/flash.rb:242:in call' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in context' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/cookies.rb:338:in call' /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.3/lib/active_record/query_cache.rb:64:in call' /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:467:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/callbacks.rb:28:in block in call' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in run_2458689492548881573_call_1062142932397414625__callbacks' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in __run_callback' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:385:in _run_call_callbacks' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81:in run_callbacks' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/callbacks.rb:27:in call' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/sendfile.rb:102:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/remote_ip.rb:31:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:16:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/show_exceptions.rb:56:in call' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/rack/logger.rb:26:in call_app' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/rack/logger.rb:16:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/request_id.rb:22:in call' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in call' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:17:in call' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/cache/strategy/local_cache.rb:72:in call' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb:15:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/static.rb:62:in call' /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in forward' /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in fetch' /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in lookup' /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in call!' /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in call' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:479:in call' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/application.rb:220:in call' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in method_missing' /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/rack/developer_mode.rb:24:in call' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/content_length.rb:14:in call' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/rack/log_tailer.rb:14:in call' /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:80:in block in pre_process' /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:78:in catch' /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:78:in pre_process' /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:53:in process' /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:38:in receive_data' /app/vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in run_machine' /app/vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in run' /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/backends/base.rb:63:in start' /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/server.rb:159:in start' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler/thin.rb:13:in run' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:265:in start' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in start' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:55:in block in ' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:50:in tap' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:50:in ' script/rails:6:in require' script/rails:6:in '

Bashar Abdullah
  • 1,545
  • 1
  • 16
  • 27

1 Answers1

1

Try pushing this to a new heroku app run:

heroku create

and then push. There is an issue when moving an app from one ruby version to another if you had a very specific set of gems installed. Let me know if that works or does not.

Schneems
  • 14,918
  • 9
  • 57
  • 84
  • Thanks. So I will need to reconfigure all add-ons to get this to work? – Bashar Abdullah Aug 14 '12 at 09:17
  • no, we're just doing this for debugging so the only things you need to copy over right now is the gemfile and the gemfile.lock parts of your rails app (along with the rails app). Then if the app can successfully `$ bundle install` then it will show if the error is the one I previously mentioned. – Schneems Aug 14 '12 at 13:56
  • tried that. Running heroku run "ruby -v" gives ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]. But still I get the same error TypeError: can't convert Array into String from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.2.0/lib/moped/node.rb:214:in `getaddrinfo' – Bashar Abdullah Aug 15 '12 at 13:54
  • So you are saying that the same version of the app with the same version of the gem worked previously on Heroku cedar but when you just bumped the ruby version to 1.9.3 this quit working? Does it work locally with 1.9.3? What value are you passing into this initializer? https://github.com/mongoid/moped/blob/master/lib/moped/node.rb#L214 ? – Schneems Aug 15 '12 at 17:59
  • Are you setting the url in your mongoid.yml ? http://stackoverflow.com/questions/2784417/heroku-mongohq-and-mongoid-mongoconnectionfailure – Schneems Aug 15 '12 at 23:18
  • I have posted the mongoid.yml above. It has been recently verified by MongoHQ support, and I'm not having connection issues. I doubt it's related – Bashar Abdullah Aug 16 '12 at 08:50
  • 1
    I've not used mongoid before, and i've never used this gem, if I was experiencing this issue myself on another gem I would fork their copy, add it to my gemfile using `:git => ` and add in debug print outs in the code above the offending lines `Rails.logger.error host.inspect`. Commit to git, push back to your fork, run `$ bundle update moped` to verify it works locally and you see an output from your logging statement, then push to Heroku. My guess is that gem isn't properly parsing your config. If you are in contact with mongoHQ they will be able to help you much more then me. – Schneems Aug 16 '12 at 15:08
  • Did you follow these directions for mongoid3 ? https://devcenter.heroku.com/articles/mongohq looks like for using replica sets you have to manually parse and enter in your urls instead of using environment variables. One debugging option could be to try to connect to your production mongo from development and see if you get errors – Schneems Aug 16 '12 at 15:09
  • regarding mongoid.yml, it says if you deploy a replica through the addon it will not include both members. At any rate, this would cause connection error. As for debugging it, the thing is I have faced the same bug locally, debugged it, and realized it needs Ruby 1.9.3 for sure. So I definitely need to have Heroku to run Gem using Ruby 1.9.3. can you please advise how to get Ruby 1.9.3? – Bashar Abdullah Aug 16 '12 at 18:26
  • I'm confused, you already had ruby 1.9.3 working earlier. Just add it to your gemfile like you mentioned in your original post. You can verify your version by running `$ heroku run 'ruby -v'` as outlined in this post, that I wrote: http://blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku/ – Schneems Aug 16 '12 at 22:02
  • I didn't have it working. It said it was using Ruby 1.9.3, but when I run the 'ruby -v' command on my prod app this is what I get: Running `ruby -v` attached to terminal... up, run.1 ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]. Also, as I showed, the moped gem is using Ruby 1.9.1. This has caused the same "Can't covert Array into String" locally until I upgraded. – Bashar Abdullah Aug 16 '12 at 22:29
  • I noticed the blog post is using Rails 3.2.3 and I was lower than that. Just to be on the safe side I tried it. Alas, still same thing – Bashar Abdullah Aug 16 '12 at 23:34
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/15443/discussion-between-schneems-and-bashar-abdullah) – Schneems Aug 17 '12 at 02:05
  • The version of Rails does not matter, the version that shows up in your backtrace does not matter as it will always show 1.9.1 no matter what version you are running. If you are unable to finish the `bundle install` process of deploying your app, i.e. if the app cannot deploy then the version number will not change. Only if the deployment succeeds does the version gets changed. Can you give me the full output of a deploy from the git push, to the success message. And the full backtrace from the logs where you are seeing that error message? Update your post, and ping this comment. – Schneems Aug 17 '12 at 02:09
  • OK I owe you an apology. First, I tried another push and this time it took Ruby 1.9.3 when I try heroku run 'ruby -v'. Problem persisted however, and trying to fork/debug Moped as you suggested, turns out it was problem with address being sent as Array. I tried the same suggested config https://devcenter.heroku.com/articles/mongohq with no luck, so I did little patch on my fork for now https://github.com/basharabdullah/moped/commit/5903938a344a3aec1025e1a36e8c0b891517ca87 (Line 212 is the fix. Last commit was removing debug messages). It's working now. Does it make sense? – Bashar Abdullah Aug 18 '12 at 05:37