Steps to reproduce
01) portal.azure.com
> [ select my web app service ]
> Properties
> Outbound IP addresses
> [ copy ]
02) MongoDB Atlas
> Network Access
> + Add IP Address
(for each outgoing IP address of the web app and my own PC IP address for local testing)
Expected Behaviour
I can make requests to MongoDB Atlas.
Actual Behaviour
It works:
- In local environment
- In non-local environment (i.e calling from Azure web app) if I 'allow access from anywhere' in
MongoDB Atlas
>Network Access
It does not work:
- In non-local environment (i.e calling from Azure web app) if I remove the 'allow access from anywhere' in
MongoDB Atlas
>Network Access
It times out with this message in Azure web app log stream and then crashes the app:
/home/site/wwwroot/node_modules/mongodb/lib/sdam/topology.js:543
drainWaitQueue(topology[kWaitQueue], new error_1.MongoTopologyClosedError());
MongoTopologyClosedError: Topology is closed
at processWaitQueue (/home/site/wwwroot/node_modules/mongodb/lib/sdam/topology.js:543:46)
at Topology.selectServer (/home/site/wwwroot/node_modules/mongodb/lib/sdam/topology.js:290:9)
at Topology.<anonymous> (/home/site/wwwroot/node_modules/mongodb/lib/sdam/topology.js:43:94)
at node:internal/util:364:7
at new Promise (<anonymous>)
at Topology.selectServerAsync (node:internal/util:350:12)
at executeOperationAsync (/home/site/wwwroot/node_modules/mongodb/lib/operations/execute_operation.js:39:24)
at /home/site/wwwroot/node_modules/mongodb/lib/operations/execute_operation.js:12:45
at maybeCallback (/home/site/wwwroot/node_modules/mongodb/lib/utils.js:338:21)
at executeOperation (/home/site/wwwroot/node_modules/mongodb/lib/operations/execute_operation.js:12:38) {
[Symbol(errorLabels)]: Set(0) {}
}
I am testing the web app service and therefore cannot get Microsoft Support without paying for a support subscription.
I am very sure that I added all the IP addresses correctly.
Related Reading
How can I determine the IP address of an Azure hosted WebApp