Network errors making REST calls from Azure function

Ken Faubel 26 Reputation points
2021-12-31T23:48:22.21+00:00

I have a Node based Azure function package with about 10 timer triggers. They make REST API calls to various services (Google, National Weather Service, NASA, NOAA, MLB...). When I run locally everything works as expected but when I deploy I get random network errors. Some are "Client network socket disconnected before secure TLS connection was established" and some are timeout errors (2, 5, 10 seconds). The calls all work at most of the time but the failures happen 10-20% of the time compared with near 0 running the function package locally. There are no triggers that fail all the time.

Is there a configuration that controls the number of network connections? The 10 triggers fire on differrent schedules but I am sure some overlap sometimes. I don't stagger them (some at 7 and 37 past the hour, some at 8 and 38 past the hour, etc.).

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,873 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,136 Reputation points
    2022-01-04T03:49:09.773+00:00

    @Ken Faubel I will suggest you to review the Diagnose and solve problems for your function app to know the root cause of the issue and the possible action plan that can help you to resolve the issue. It looks like a port exhaustion issue at your function app and I will suggest reviewing your function app code to reuse the connection to external services rather than creating a new connection for every request. I will also suggest you to review the function best practices and how to manage connection in the function app to fix the issue.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.