I have an Ubuntu VM in Google cloud which is having my Mongo Instance running.

  1. I have enabled authentication
  2. Mongo config is configured to bind for the and the internal IP of the server.
  3. In google console I've the 27107 TCP port opened.
  4. The port is open in the VM too.
  5. But when i try to connect to the Mongo instance using the internal IP of the server from a Node JS App Service I'm getting an error as shown below. any idea why is that?

    failed to connect to server [:27017] on first connect [MongoError: connection 0 to :27017 timed out]' }

I'm also able to connect to server using mongo shell using the google cloud console.

  • Are your running your Node JS App on APP Engine? – Cloud Ace May 27 at 12:51

Seems you are connecting from App Engine to GCP, you have to configure VPC to do that. Detailed here: https://cloud.google.com/vpc/docs/configure-serverless-vpc-access

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.