Pages

Monday 23 March 2020

Strapi MongoError: not master and slaveOk=false

I tried using Strapi with cloud.mongodb.com and I got an error:

yarn run v1.19.1
$ strapi develop
[2020-03-23T19:00:55.263Z] error An index error happened, it wasn't applied.
        - not master
[2020-03-23T19:00:55.507Z] error An index error happened, it wasn't applied.
        - not master
[2020-03-23T19:00:55.509Z] error An index error happened, it wasn't applied.
        - not master
[2020-03-23T19:00:55.791Z] debug ⛔️ Server wasn't able to start properly.
[2020-03-23T19:00:55.795Z] error MongoError: not master and slaveOk=false

All I was able to find out is that it has something to do with cluster configuration. I didn't see option to set slaveOk parameter anywhere in Strapi documentation. I'm sure there are better solutions to this but still I didn't want to spend too much time on this.

My fix was to add in database.json all 3 hosts within host line:

"host": "xxx-shard-00-00-rxyat.mongodb.net,xxx-shard-00-01-rxyat.mongodb.net,xxx-shard-00-02-rxyat.mongodb.net",

No comments:

Post a Comment