@Pritesh Patel Thanks for reaching out. Can you please check and confirm till what time (in minutes) your function executed and returns the 500 error.
500 errors could happen due to multiple reasons due to unhandled exceptions in your code or function app timeouts.
It sounds like you are experiencing a timeout issue with your Azure Function. By default, Azure Functions have a timeout duration of 5 minutes for the Consumption plan and 30 minutes for the Premium and Dedicated plans. However, there is a maximum timeout duration of 10 minutes for the Consumption plan and unlimited for the Premium and Dedicated plans.
Based on the information you provided, it seems that your function is taking longer than the default timeout duration to complete, which is causing the 500 error. To resolve this issue, you can try increasing the timeout duration for your function by setting the functionTimeout
property in the host.json
file
{
"version": "2.0",
"functionTimeout": "00:10:00"
}
If increasing the timeout duration does not resolve the issue, you may want to consider using Durable Functions to handle long-running processes. Durable Functions allow you to write stateful functions that can run for an extended period of time and can be paused and resumed as needed.
The function will run to completion but I can not receive a response from the function after the 500. After the function finishes running I can look at the complete database with default entries inserted into the newly created database.
It is the expected behavior in case if function timeout then it returns 500 error. But to know the cause of the 500 error you can review the diagnosis and solve blade on your function app.
This issue is present in my deployed Staging Environment, but not when running locally. When I run locally the function behaves as expected.
Different function plan/SKU has different capacity to run your code and the code may take higher time to execute if you are running in consumption plan where there is limited capacity.