@Mark McElhinney Apology for the delay in reaching out. As per the error, it looks like the socket exception and the reason for this error is that you reached the limit of the maximum available socket at your function app and sandbox disabled access for new sockets.
It looks like your function app code is creating a new connection to the Cosmo DB for every request coming to your function. You should only create the connection once and reuse it.
I will suggest you to review managing cosmo DB clients as mentioned in this document and define the static client object while creating the connection.
Feel free to get back to me if you need any assistance.
Hi @Mark McElhinney ,
Following up to see if @MayankBargali-MSFT answer helps. Do let us know if you have any queries.
Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.