admin管理员组文章数量:1277885
I have a number of functions in a .Net 9 function app, running under the isolated model, that occassionally return a 499 error AFTER the actual work of the function has completed.
The function looks like this:
public async Task<IActionResult> RunAsync([HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequest req)
I can see from the logs that the function has performed its task correctly and is then attempting to return an OKObjectResult - this is when the error occurs.
Here's the end of the log trace that shows the error:
I have noted, in the list of invocations, that the invocations that have returned an error are fairly widely spaced apart. The function, when it executes, does access a database which may take a moment to spin up. Yet, when looking at the time things take, the database calls take about 2 seconds to complete and the whole function is done in less that 4 seconds. I would have thought that this was plenty of time for the function to complete and return a valid result. The calling site (JotForm in this case) say they wait 30 seconds for a response, so they should still be listening for a response.
Here's a sample of the timing of the invocations:
The more I think about it, it appears to be a timing issue of some sort - but how to fix it?
Thanks Gordon
I have a number of functions in a .Net 9 function app, running under the isolated model, that occassionally return a 499 error AFTER the actual work of the function has completed.
The function looks like this:
public async Task<IActionResult> RunAsync([HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequest req)
I can see from the logs that the function has performed its task correctly and is then attempting to return an OKObjectResult - this is when the error occurs.
Here's the end of the log trace that shows the error:
I have noted, in the list of invocations, that the invocations that have returned an error are fairly widely spaced apart. The function, when it executes, does access a database which may take a moment to spin up. Yet, when looking at the time things take, the database calls take about 2 seconds to complete and the whole function is done in less that 4 seconds. I would have thought that this was plenty of time for the function to complete and return a valid result. The calling site (JotForm in this case) say they wait 30 seconds for a response, so they should still be listening for a response.
Here's a sample of the timing of the invocations:
The more I think about it, it appears to be a timing issue of some sort - but how to fix it?
Thanks Gordon
Share Improve this question asked Feb 23 at 22:16 OzTrakOzTrak 1152 silver badges14 bronze badges 1 |1 Answer
Reset to default 0As mentioned in MSDOC, an HTTP 499 error occurs if a client request is closed abruptly before the server finished responding.
- This happens when a large response is returned to the client, and the client might have closed or refreshed the application before the server finished sending a large response.
- When the timeout on the client side is low and doesn't wait long enough to receive the response from server.
To resolve this, I would suggest increasing the timeout on the client by adding functionTimeout
setting in host.json
.
{
"functionTimeout": "00:30:00" // 30 minutes
}
host.json:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
},
"enableLiveMetricsFilters": true
}
},
"functionTimeout": "00:30:00"
}
Review the function's async behavior and make sure all asynchronous tasks are being awaited properly.
Run the function locally and check if you get the same error.
Go to
FunctionApp=>Monitoring=>LogStream
, review the logs for detailed error
本文标签: Azure Function App Returning 499 Error When Executing OKObjectResultSometimesStack Overflow
版权声明:本文标题:Azure Function App Returning 499 Error When Executing OKObjectResult - Sometimes - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741300576a2371067.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
functionTimeout
setting in host.json. – Pravallika KV Commented Feb 24 at 11:36