mongodb-developer / pymongo-fastapi-crud

PyMongo with FastAPI CRUD application
Apache License 2.0
131 stars 46 forks source link

SSL Certificate error #1

Open alfcar62 opened 1 year ago

alfcar62 commented 1 year ago

I'm a beginner of Python and MongoDB but I have tried your code and it works perfecty on local MongoDB. If i try to access to the same database on Atlas Cloud and in tis case occurrs the error "SSL Certificate invalid". I've tried but i don't know how to resolve it.

yoandysse commented 1 year ago

I'm a beginner of Python and MongoDB but I have tried your code and it works perfecty on local MongoDB.

If i try to access to the same database on Atlas Cloud and in tis case occurrs the error "SSL Certificate invalid".

I've tried but i don't know how to resolve it.

Hi, are you using Mac or Windows? If you are using Mac after the installation of Python on your system you must execute the code "Install Certificate.comand" is inside the installation folder, otherwise any connection that uses SSL will generate an error.

yoandysse commented 1 year ago

I'm a beginner of Python and MongoDB but I have tried your code and it works perfecty on local MongoDB.

If i try to access to the same database on Atlas Cloud and in tis case occurrs the error "SSL Certificate invalid".

I've tried but i don't know how to resolve it.

Hi, are you using Mac or Windows? If you are using Mac after the installation of Python on your system you must execute the code "Install Certificate.comand" is inside the installation folder, otherwise any connection that uses SSL will generate an error.

rubik12023 commented 1 year ago

I got the same issue.

I have solved: change main.py import ssl

app.mongodb_client = MongoClient(config["ATLAS_URI"], ssl=True, ssl_cert_reqs=ssl.CERT_NONE)
app.database = app.mongodb_client[config["DB_NAME"]