Extend The Azure Functions Execution Timeout Value

13 September, 2022

AzureJavascriptTypescript

In every Azure Functions project there is a host.json file that is created when initialising the project.

By default, this file contains some settings for the version, any logging that is enabled to Application Insights and other versioning items for Microsoft libraries.

However, this file can also have properties added to it. In the case of needing to extend the maximum function execution timeout value, we can add the "functionTimeout" property and give it a valid string value.

An example from a Typescript/NodeJs function app that has had the timeout extended to the maximum 10-minute value is:

{ "version": "2.0", "logging": { "applicationInsights": { "samplingSettings": { "isEnabled": true, "excludedTypes": "Request" } } }, "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", "version": "[2.*, 3.0.0)" }, "functionTimeout": "00:10:00" }

This project has Application Insights logging enabled and is running on Azure Functions version ~4 with the (at the time of writing this) latest version of the Azure CLI used to initialise the Functions app project.

As you can see, the "functionTimeout" property accepts a string in the format of "hh:mm:ss" so that, if desired, it is possible to set a very precise value for the maximum time your functions can execute for.

It is worth noting that this is an app-wide setting and it is not possible to limit the execution time of individual functions. By setting this value, all functions within your app can execute up to the configured amount of time.

If you liked this post, please share it!