Why does Appinsights show a 200 Success for function and client is getting a 500.

mikefinch87 115 Reputation points
2024-01-29T15:12:34.0933333+00:00

I have an AZure Function that pulls data from COSMOS, and returns as a json object. After putting Try/catch around OOM errors to generate a 400 series error with a message telling client to ask for less data. I am now occassionally getting azure to return a 200 response, but the client receives: <font color="#aa0000"> <h2>500 - The request timed out.</h2></font> The web server failed to respond within the specified time. APP Insights Logs |7:59:20.612 AM|Trace|Severity level: Information, Message: Executing 'Functions.

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

Accepted answer
  1. Q&A Assist
    2024-01-29T15:12:34.0966667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The Azure Function is returning a 200 Success response code, but the client is receiving a 500 error with a message that the request timed out. One possible reason for this issue is that the function is taking too long to respond, causing the client to time out. To troubleshoot this issue, you can enable Application Insights and query for exceptions to identify any errors that may be occurring. Additionally, you can check the functionTimeout property in the host.json project file to ensure that the function is not taking longer than the specified timeout duration to execute.

    References:

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. mikefinch87 115 Reputation points
    2024-02-22T13:07:22.8966667+00:00

    Root Cause was that this was the FunctionLoadBalancer timing out in 230 seconds and returning the 502 while the function eventually finished working.

    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.