Azure function calling API yeild SocketException No such host is known

Imran Qadir Baksh 1 Reputation point
2022-06-09T14:30:34.49+00:00

We have Azure function that calling api.lokalise.com domain. But we are seeing too much errors for,

SocketException No such host is known

Does Azure function don't have internet to call HTTP API or does it depend upon Azure plan? We have plan (Y1: 0).

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

2 answers

Sort by: Most helpful
  1. MayankBargali-MSFT 70,936 Reputation points Moderator
    2022-06-13T05:34:19.327+00:00

    @Imran Qadir Baksh Thanks for reaching out. As per the error 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 (api.lokalise.com) 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 function app to fix the issue.

    You can always refer to Diagnostics and solve problems blade to get more insights on the issue along with the action plan to resolve the issue.

    Feel free to get back to me if you need any assistance.


  2. Magnus Gladh 1 Reputation point
    2022-08-08T08:36:05.363+00:00

    @MayankBargali-MSFT I am also facing the same issue. I am trying to reach an API from an Azure Function on a Consumption plan, and it randomly comes back with thie "No such host is known" exception. I hade 20 request during this weekend that hade failed.

    I started an instance of my function on my local machine and hade the function running in azure also. The azure function is triggered by a message in a Storage queue, and when I put the 20 failed messages in the queue. 16 was picked up by my local machine and executed correctly, and 4 was picked up the function in azure and all failed with this "No such host is known" exception.

    I am using a static HttpClient and is doing 1 request, so I don't think there is an issue with to many connections.

    0 comments No comments

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.