Replit, I just can't. MongoDB stopped working again (MongoServerSelectionError: ReplicaSetNoPrimary)

The same thing keeps happening to me while paying for always awake. It doesn’t happen too often but every couple of days I see it happen again.

yeah, that’s what I mean.

Still down. This is really frustrating

The team have know about this for more than half a month. This is a complex issue and they have been working hard on a fix. @IroncladDev any updates?

Unfortunately I don’t have much context on this. Handing it over to @ShaneAtReplit

This has been an issue for a while, really frustrating (I have a lot of projects relying on MONGO)

No updates yet. I’ve been making sure we’re working on a fix


These MonogDB connection issues are still happening on a regular basis with my Repls. Very frustrating, especially because I’m paying for Always On and I have no control over the outages.

This is no longer the case. We have been able to reproduce and no longer need users to perform these steps.

1 Like

after dig

; <<>> DiG 9.18.8 <<>> @
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 3065
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

; EDNS: version: 0, flags:; udp: 1232
; IN A

;; Query time: 12 msec
;; WHEN: Sun Apr 09 12:13:24 UTC 2023
;; MSG SIZE  rcvd: 71

Please see below the link to my repl. The Repl used to connect fine for some time but for more than a day now there is the same error as described in this post and although it manages to connect for a small period of time it drops off soon after.

Welcome to Replit Ask! I hope mongodb starts working eventually.

1 Like

This is my error, and use this to connect to mongo

async function connectDB() {
mongoose.set(‘strictQuery’, false);
await mongoose.connect(MONGO).then(() => console.log(“Database Connected! Hopefully ig”.red)).catch((e) => console.log(Database Connection Failed: ${e} .red))

1 Like

Try whitelisting in your db configuration.


aldready done… also this is happening on all of my bots and the network access IS allowed from anywhere

Same in my case. Several repls behaving the same. My network access in MongoDB is set to public allowing connection from anywhere.

I’ve got the same issue here, even though my MongoDB server allows network access from any IP.


Me facing same Issue you have any Solution about this please Share me

yes Your Idea is working Now Thank you so Much