Failed to connect to any secondary or primary nodes in heroku

I downloaded the Sinatra Heroku app. Before that, I installed the free MongoHQ addon. However, I have an error from heroku:

 Moped::Errors::ConnectionFailure - Could not connect to any secondary or primary nodes for replica set <Moped::Cluster nodes=[<Moped::Node resolved_address="127.0.0.1:27017">]> 

Here is my mongoid.yml

 development: sessions: default: database: my_db hosts: - localhost:27017 options: timeout: 10 production: sessions: default: uri: <%= ENV['MONGOHQ_URL'] %> 

So why is this happening?

+4
source share
1 answer

If you run heroku config , you will see if the hero adds MONGOHQ_URL to which your mongoid.yml refers. Another possibility is that you did not set your RACK_ENV = production via heroku config:add RACK_ENV=production

Can you show us the result of the heroku config ?

0
source

All Articles