Connect to MongoDB Atlas from Google App Engine Standard

2,619 views
Skip to first unread message

Raj Chaudhary

unread,
Oct 30, 2018, 1:55:00 PM10/30/18
to Google App Engine

I can successfully connect to a MongoDB database hosted on mLab from Google App Engine Standard (Node.js 8 runtime) using the 3.4+ driver.


But I can't connect to a MongoDB database hosted on MongoDB Atlas from Google App Engine Standard (Node.js 8 runtime) using both, 3.6+ driver as well as 3.4+ driver.


3.6+ driver connection string:



3.4+ driver connection string



Please help!

Yasser Karout (Cloud Platform Support)

unread,
Oct 30, 2018, 5:25:12 PM10/30/18
to Google App Engine
Hello,

Can you provide the error you get when you try connecting to MongoDB database hosted on MongoDB Atlas? It will help troubleshooting what went wrong.

Your question might be better addressed on StackOverflow as the format is more suited for development questions and will give your issue greater visibility. Groups is more suited for general discussions.


Raj Chaudhary

unread,
Oct 31, 2018, 5:17:05 AM10/31/18
to Google App Engine
I get the following error message: "Error: querySrv ESERVFAIL _mongodb._tcp.youtopia-dev-wc9dj.gcp.mongodb.net"

Same exact code works fine from my local dev machine.

I have already asked the same question on StackOverflow but no response there so far, here is the link - https://stackoverflow.com/questions/53069856/connect-to-mongodb-atlas-from-google-app-engine-standard

This was really urgent so your quick response would be appreciated.

Attila-Mihaly Balazs

unread,
Oct 31, 2018, 6:25:04 AM10/31/18
to Google App Engine
I'm not very familiar with MongoDB or either of those services (I only know that they provide hosted MongoDB services), but from a quick check it seems that the referenced host (_mongodb._tcp.youtopia-dev-wc9dj.gcp.mongodb.net) does not exists (ie. doing an nslookup on it returns "no such domain").

So I would suspect that it's a (DNS) configuration error. Can you connect to this database from your local machine for example?

Attila

Raj Chaudhary

unread,
Oct 31, 2018, 9:34:09 AM10/31/18
to Google App Engine
It always works from my local machine. Also works from GAE but only for some time after updating the instance.

To the best of my knowledge, this seems to be a GAE outbound connection issue.

- Raj

Mohammad I (Cloud Platform Support)

unread,
Oct 31, 2018, 7:03:14 PM10/31/18
to Google App Engine

Hello Raj,


A possible workaround of your issue has been provided here. At the StackOverflow thread it is suggested to use an older version of the MongoDB atlas url and set the new url to false.


In case the above mentioned workarounds still does not resolve the issue you can reach out to MongoDB atlas support which is a third party product, for a possible solution or to find out whether MongoDB atlas 3.4 and 3.6 is compatible with Google App Engine Standard Environment.


If you believe it is a platform specific issue, you can report the issue using the issue tracker as detailed inspection of logs and troubleshooting will be required to resolve the issue. In case you need to share any private or project specific information, please choose the “Private” component so that the information is not visible to the public.


dominic tobias

unread,
Dec 18, 2018, 10:09:23 PM12/18/18
to Google App Engine
Thanks I got it to work using the old style connection string 👍

dominic tobias

unread,
Dec 18, 2018, 10:09:41 PM12/18/18
to Google App Engine
I have exactly the same problem, I also tried the old style of string when connecting to a replica set but still the same issue. Also works fine on localhost. Did you find a solution?


On Tuesday, 30 October 2018 17:55:00 UTC, Raj Chaudhary wrote:

I can successfully connect to a MongoDB database hosted on mLab from Google App Engine Standard (Node.js 8 runtime) using the 3.4+ driver.


But I can't connect to a MongoDB database hosted on MongoDB Atlas from Google App Engine Standard (Node.js 8 runtime) using both, 3.6+ driver as well as 3.4+ driver.


3.6+ driver connection string:



3.4+ driver connection string


Tiago (Google Cloud Platform Support)

unread,
Jan 3, 2019, 1:34:12 PM1/3/19
to Google App Engine

Hello Dominic,


Your previous comment seemed to indicate that using the older version of the Atlas URL and setting the new URL parser to false resolved the error message “ERROR db_connection querySrv ESERVFAIL <mongo-url>.gcp.mongodb.net”. Can you please clarify what issue still persists?


Also, let me reiterate Yasser’s comments above, as these types of questions are better addressed on StackOverflow where you have access to a large community of enthusiasts and experts to share ideas with and get support from. Please make sure to include all relevant details and error messages which would help the community troubleshoot. Please kindly note that Google Groups is more suited for general discussions, not for specific technical issues.

sahib singh

unread,
May 21, 2020, 7:47:51 AM5/21/20
to Google App Engine

Hello There,

I have solved this query by simply exporting the router like module.exports = router;
Reply all
Reply to author
Forward
0 new messages