Reputation: 1398
I have a nodejs client making request to an azure api management endpoint. I am getting the following exception sometimes:
ClientConnectionFailure: at transfer-response
So i am using the request package, and in the client i am doing a straightforward request:
request({
method: "GET",
headers: {
"contentType": "application/json",
"Ocp-Apim-Subscription-Key": key
},
uri: endpointUrl
}, function (error, response, body) {
(...)
});
So is it a timeout eventually happening in the client, in the middle of the request, and consequently failing the connection with the Azure APIM endpoint? Or something else? And how do you think i could solve this problem? I thought about increase the timeout in the request, but i am assuming that in omission of timeout, it is assuming the default timeout of the server (Azure Function App) that is 120 seconds, right?
Thanks.
Upvotes: 1
Views: 9450
Reputation: 7795
ClientConnectionFailure
suggests that client broke the connection wile APIM was processing request. at transfer-response
means that this happened when APIM was sending response to client. APIM does not cache request/response body by default, so when it's sending response to client it's at the same time reading it from backend. This may lead to client breaking off the connection if backend takes too long to respond with actual data.
This behavior is driven purely by client deciding to stop waiting for data. Check how long it takes for you on client before you send request and see the error. Try adjusting client timeout.
Upvotes: 4
Reputation: 1811
We have seen this behavior when the back end is taking too long to respond.
My approach would be to take a look at the backend first which is Function app in this case and see the time taken and then see if there are any timeout limit set at APIM.
The timeout duration of a function app is defined by the functionTimeout property in the host.json project file. The following table shows the default and maximum values in minutes for both plans and in both runtime versions:
For troubleshooting Performance issue , follow this Troubleshoot slow app performance issues in Azure App Service
Upvotes: 1