Handling IGraphClient disconnections in ASPNET REST Api

Hi all,

We have an ASPNET REST Api hosted in AWS lambda and we are hosting our Neo4j cluster in Aura.

We connect to the cluster on Startup pretty much as done here MoviesMvcCore/Startup.cs at main · DotNet4Neo4j/MoviesMvcCore · GitHub.

After close to a month with this running with no major issue, the service got disconnected from the cluster making all REST Api request fail with "Client has not connected to the Neo4j server".

We immediately checked and the cluster was up and running and we were able to connect to it from other clients but we had to restart the service in order to have it connect to the cluster again.

My main question is, what's the recommended process to guarantee there is always a connection between the service and the cluster. One option we thought of was to catch and exception and it matched the one above, re-connect to the cluster but I don't think is very clean. Also, I don't really want to connect/disconnect on every request.

Any recommendations are highly appreciated.