Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"NoMethodError: undefined method `each' for nil:NilClass" #317

Open
sanjeev29 opened this issue May 6, 2020 · 1 comment
Open

"NoMethodError: undefined method `each' for nil:NilClass" #317

sanjeev29 opened this issue May 6, 2020 · 1 comment

Comments

@sanjeev29
Copy link

Getting below error for all steps that include 'rake' and also while running 'ruby app.rb'

rake aborted!
NoMethodError: undefined method each' for nil:NilClass /edx/app/forum/.gem/ruby/2.5.0/gems/mongo-2.5.3/lib/mongo/cluster.rb:192:in initialize'
/edx/app/forum/.gem/ruby/2.5.0/gems/mongo-2.5.3/lib/mongo/client.rb:454:in new' /edx/app/forum/.gem/ruby/2.5.0/gems/mongo-2.5.3/lib/mongo/client.rb:454:in create_from_addresses'
/edx/app/forum/.gem/ruby/2.5.0/gems/mongo-2.5.3/lib/mongo/client.rb:253:in initialize' /edx/app/forum/.gem/ruby/2.5.0/gems/mongoid-7.0.5/lib/mongoid/clients/factory.rb:64:in new'
/edx/app/forum/.gem/ruby/2.5.0/gems/mongoid-7.0.5/lib/mongoid/clients/factory.rb:64:in create_client' /edx/app/forum/.gem/ruby/2.5.0/gems/mongoid-7.0.5/lib/mongoid/clients/factory.rb:27:in create'
/edx/app/forum/.gem/ruby/2.5.0/gems/mongoid-7.0.5/lib/mongoid/clients.rb:69:in block in with_name' /edx/app/forum/.gem/ruby/2.5.0/gems/mongoid-7.0.5/lib/mongoid/clients.rb:68:in synchronize'
/edx/app/forum/.gem/ruby/2.5.0/gems/mongoid-7.0.5/lib/mongoid/clients.rb:68:in with_name' /edx/app/forum/.gem/ruby/2.5.0/gems/mongoid-7.0.5/lib/mongoid/persistence_context.rb:114:in client'
/edx/app/forum/.gem/ruby/2.5.0/gems/mongoid-7.0.5/lib/mongoid/clients/options.rb:78:in mongo_client' /home/sanjeev/edx/cs_comments_service/app.rb:172:in <top (required)>'
/edx/app/forum/.gem/ruby/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in require' /edx/app/forum/.gem/ruby/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in block in require'
/edx/app/forum/.gem/ruby/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:291:in load_dependency' /edx/app/forum/.gem/ruby/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in require'
/home/sanjeev/edx/cs_comments_service/Rakefile:24:in block in <top (required)>' /edx/app/forum/.gem/ruby/2.5.0/gems/rake-12.0.0/exe/rake:27:in <top (required)>'
Tasks: TOP => search:initialize => environment

@M0M0K4S4N
Copy link

M0M0K4S4N commented Oct 5, 2020

Also me on rebuild_index
https://pastebin.com/QcTqKKA0

rake aborted!
NoMethodError: undefined method `each' for nil:NilClass
...
...
Tasks: TOP => search:rebuild_index => environment

@sanjeev29
Solution found for me.
Try to set environment variable "MONGOHQ_URL" to your mongodb server connection url.

Related configuration is mongoid.yml so there is no default value for MONGOHQ_URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants