Hi Tim.
I haven’t connected to Mongo specifically but I have built API Proxies that run inside Apigee Edge, using nodejs, and connect to external data sources like:
- postgres
- MS SQL Server
- LDAP systems
- others
These things use various ports. Therefore I doubt that it is a port issue. You wrote:
I have used the NodeJS client for MongoDB locally and successfully connected to my cluster and run a query. So I know the cluster is running and can be connected to.
yes, you have proven that the Mongo server is running and listening, and that your local machine has connectivity to it. But this does not prove that the mongo server is accessible from the internet, which is where the Apigee API Proxies run. I read what you wrote about 0.0.0.0/0 and that you believe it’s not an IP whitelist issue. But there are also other possibilities - the IP restriction may be enforced by some other system that sits between Apigee and your Mongo server.
As an example, servers running on my own desktop machine cannot be contacted by systems on the internet. A firewall managed by the corporate IT team prevents the inbound connection, regardless what I have set my ip whitelist to, locally. I have no control over that.
To determine if a network connectivity issue is causing the timeout, you’d need to use an arbitrary machine running in AWS or GCP or Azure or somewhere on the open internet, and connect to the mongo server. a simple connection with telnet to port 27017 would be fine… you don’t need to actually run a mongo client to prove the connectivity, though connecting with a mongo client would also prove connectivity obviously. If you can connect from the internet, then the timeout is something specific to Apigee. If you cannot connect from the internet, then I suspect a network configuration issue is preventing communication.
Once nice option might be to use Google App Engine - you can host nodejs apps there, and maybe your code will run unchanged. If you can connect from THERE, then … it’s an Apigee issue.
It is possible that the Apigee version of nodejs (running in Trireme) is the source of the problem. As you may know, the nodejs logic that you can currently embed into an API PRoxy in Apigee Edge does not run in v8 node, but rather a JVM-hosted Javascript engine called Trireme. There are some differences, and probably the people who build the Mongo client do not test their client library on Trireme.
If you wanted to be thorough, you could test your code outside of Apigee Edge, but still in trireme. For example, you could run trireme on your local machine. Find Trireme on github.
HTH