MongoDB atlas stopped working on replit (Python, pymongo)

again, no experience with mongo but

import pymongo, os, multiprocessing
from pymongo import errors
from urllib import request
from http import server

# minimal server for if your code isn't already serving a website before you connect to mongodb
class Server(server.BaseHTTPRequestHandler):
    # Do this to override the log_request function to prevent spammy logging output
    def log_request(_, __):
        pass

    def do_HEAD(self):
        self.send_response(204)
        self.end_headers()

    do_GET = do_HEAD


multiprocessing.Process(
    target=server.ThreadingHTTPServer(("", 80), Server).serve_forever
).start()
try:
    # connect to mongo here, e.g.
    client = pymongo.MongoClient(
        f"mongodb+srv://admin:{os.environ['db-password']}@cluster0.1shpg.mongodb.net/myFirstDatabase?retryWrites=true&w=majority"
    )
except errors.ServerSelectionTimeoutError:
    request.urlopen(f"https://{os.environ['REPL_ID']}.id.repl.co")
    os.kill(1, 1)
1 Like

I’m now getting mongodb errors again (node.js), with Internal Server Error and Unknown system error -122. Looks like this issue wasn’t fully fixed and a timeframe on when this could be resolved would be great.

1 Like

Is there any update to this? Is it working again for anyone?

1 Like

No, it’s still a common error.

1 Like

This is really troublesome. It’s been 15 hours and I still can’t connect to MongoDB with replit.

1 Like

Yeah, very annoying.

1 Like

Yep really hurts my usability of Replit

1 Like

I don’t think it’s an issue on Replit’s side. I don’t know for certain, but my theory is that one of Replit’s IPs is blacklisted from Mongo as it’s only an issue sometimes and kill 1 sometimes helps.

1 Like

I apologize for our sparse updates! We are still coordinating with our upstream providers to find the cause. I have prompted the Replit team for an update and will revert here once I get a reply.

2 Likes

having the same issue, it’s been like this for since yesterday for me. Tried connecting to a different cluster and same issue

1 Like

Any update or solution for this issue?

Welcome comjoueur, @STCollier , @cheshire1, @ThiagoGlauco , @thedankboi , @MisterNoBot , @DooM , @WTV111 , and @1Tim to the ask forum! :wave: Everyone keeps forgetting to say welcome =\

This Problem is A deal Breaker The Server Is Unable To Connect To the Database And it’s causing a lot of down time (till now mostly down time) please an urgent fix is required

2 Likes