Unable to use Connection string URI in python flask app on Google App Engine

101 views
Skip to first unread message

Parayya

unread,
Oct 16, 2017, 6:13:51 PM10/16/17
to mongodb-user
I'm deploying python flask application on Google App Engine(runtime: python27), which uses database connection and I'm using Mongodb Atlas connection string uri.
But I'm getting the error as 'ServerSelectionTimeoutError:SeverSe..denied'.

shane....@10gen.com

unread,
Oct 16, 2017, 6:46:10 PM10/16/17
to mongodb-user
MongoDB Atlas blocks connections from unknown IP addresses by default. Have you whitelisted your Google App Engine IP address? https://docs.atlas.mongodb.com/security-whitelist/

Parayya

unread,
Nov 2, 2017, 12:46:19 AM11/2/17
to mongodb-user
Thanks for the reply Shane,

I allowed it to access public(0.0.0.0/0). I'm getting error at Mongodb insert operation.

Wan Bachtiar

unread,
Nov 3, 2017, 12:56:34 AM11/3/17
to mongodb-user

I allowed it to access public(0.0.0.0/0). I’m getting error at Mongodb insert operation.

Hi Parayya,

Could you post the exact error stacktrace that you’re getting ?
Are you getting the error message when you’re developing locally ?

If the error is related to some restrictions on Google App Engine side (i.e. sockets ), I’d suggest to post the question at Google App Engine Community forum to reach a more suitable audience.

Regards,
Wan.

Parayya

unread,
Nov 8, 2017, 6:48:52 AM11/8/17
to mongodb-user

Hi Wan Bachtiar,

Yes, It is working fine local server.
But in GAE I'm getting error at line where I'm inserting a document into mongodb.
I'm getting error as '
ServerSelectionTimeoutError: ServerSe...denied',)'.
Not able to do any operations (CRUD) on database. And I'm using MongoDB connection string URI and its working fine locally.

Wan Bachtiar

unread,
Nov 16, 2017, 6:57:42 PM11/16/17
to mongodb-user

I’m using MongoDB connection string URI and its working fine locally.

Hi Parayya,

Try to contact Google Cloud Platform Support to make sure that the necessary sockets/ports are available from within Google App Engine to connect to an external database.

Regards,
Wan.

Reply all
Reply to author
Forward
0 new messages