I'm trying to set up an API on the Google App Engine standard environment but I'm having trouble connecting to a distant MongoDB instance.
I use a free M0 cluster on MongoDB Atlas, all IP are whitelisted. The Google App Engine firewall rules allow all traffic from all IP addresses to make sure the connection request is not blocked.
However, I cannot connect to my Mongo instance and I get the following error:
ERROR db_connection querySrv ESERVFAIL <mongo-url>.gcp.mongodb.net
To connect to the MongoDB instance I use Mongoose and do the following:
const db = await mongoose.connect(uri, { useNewUrlParser: true });
However db
will always be null since I cannot connect. Is there a way to connect to MongoDB Atlas from App Engine Standard or do I have to use Cloud Datastore ?