title: Connect to MongoDB Atlas from Google App Engine
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>However, I cannot connect to my Mongo instance and I get the following error:</p>
  
  <p><code>ERROR db_connection querySrv ESERVFAIL &lt;mongo-url&gt;.gcp.mongodb.net</code></p>
  
  <p>To connect to the MongoDB instance I use Mongoose and do the following:</p>
  
  <p><code>const db = await mongoose.connect(uri, { useNewUrlParser: true });</code></p>
  
  <p>However <code>db</code> will always be null since I cannot connect. Is there a way to connect to MongoDB Atlas from App Engine Standard or do I <strong>have to</strong> use Cloud Datastore ?</p>