0

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

user1063287
  • 10,265
  • 25
  • 122
  • 218

1 Answers1

0

Well this worked:

01) portal.azure.com > [ select my web app service ] > Properties > Outbound IP addresses > [ copy ] (this has 7 IP addresses)

02) portal.azure.com > [ select my web app service ] > Properties > Additional Outbound IP Addresses > [ copy ] (this has 25 IP addresses, including 6 of the ones above)

03) MongoDB Atlas > Network Access > + Add IP Address

(for each of these outgoing IP addresses of the web app and my own PC IP address for local testing)

The reason I didn't initially add these 'additional' ip addresses is that the help text next to the Additional Outbound IP Addresses section in Azure states:

Additional Outbound IP Addresses represents the union of all possible outbound addresses that can be used when running in either Premium V2 or other SKUs.

I am using free tier, so not sure why those additional IP's were being utilised.

Another person seems to have experienced the same behaviour here:

https://stackoverflow.com/a/72436266

user1063287
  • 10,265
  • 25
  • 122
  • 218