From the information I see provided here I only see one mention of the Node driver used here, which is from the 4.x branch which is EOL. I would first recommend upgrading to the latest driver (6.9.0) to ensure all of the improvements we have made for running in FaaS environments are present.
Secondly in the code example the object getting “cached” is the promise returned by MongoClient.connect(). If this promise for some reason rejects, then every subsequent use of this promise will reject and our reconnection logic will never get called. It’s our recommendation to never cache the connect() promise but rather the instance of the MongoClient itself.