I'm using Python 3.7 and Flask 1.0.2
I plugged my app to mongoDB Atlas, and all works fine in local
client = pymongo.MongoClient(connector)
connector is my standard connection string given by Atlas
connector = "mongodb://xxx:<PASSWORD>@xxcluster-shard-00-00-y0phk.gcp.mongodb.net:27017,xxcluster-shard-00-01-y0phk.gcp.mongodb.net:27017,xxxcluster-shard-00-02-y0phk.gcp.mongodb.net:27017/test?ssl=true&replicaSet=xxxCluster-shard-0&authSource=admin&retryWrites=true"
When I deploy my app to Google App Engine standard Python3 runtime environment, it does not works. Would anyone have an idea of the problem?
Code: Log of Appengine:
Local log(works fine in local):
Appengine error:
pymongo.errors.ServerSelectionTimeoutError: connection closed,connection closed,connection closed"
The problem was the Ip Whitelist, thus I have add via the vpc peering connection with gcp.
To do simple, we can add 0.0.0.0/0 to allow access from anywhere(but, be careful)
.
In my case, I had ssl=False
. Hope this helps someone!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With