Skip to content

Commit 14e9d56

Browse files
gaboesquivelAwk34
authored andcommitted
docs(readme): add note on heroku mongohq replicaset connection error
closes #806, [skip ci]
1 parent ac4a990 commit 14e9d56

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: readme.md

+13
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,19 @@ If you're using mongoDB you will need to add a database to your app:
318318

319319
heroku addons:create mongolab
320320

321+
Note: if you get an `Error: No valid replicaset instance servers found` you need to modify moongose connection options in config/environment/production.js as follows:
322+
```
323+
options: {
324+
db: {
325+
safe: true,
326+
replset: { socketOptions: { keepAlive: 1, connectTimeoutMS: 30000 } },
327+
server: { socketOptions: { keepAlive: 1, connectTimeoutMS: 30000 } }
328+
}
329+
}
330+
```
331+
One of the odd things about the Node driver is that the default timeout for replica set connections is only 1 second, so make sure you're setting it to something more like 30s like in this example.
332+
333+
321334
Your app should now be live. To view it run `heroku open`.
322335

323336
>

0 commit comments

Comments
 (0)