ShaneKm
ShaneKm

Reputation: 21368

Azure Function Timeout after 30 minutes

I have set up an Azure Function v3. Configured with Standard plan per this document: https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json#functiontimeout. Also, set up functionTimeout to Unlimited

Is Standard (S1:1) plan the right one? Do I need to change it to P1V12 in order to be able to set it to 'unlimited' timeout?

enter image description here enter image description here host.json:

enter image description here

Keeps crashing after 30 minutes: enter image description here

It's as if host.json is not being considered? or is the plan not correct? Please help.

Upvotes: 5

Views: 15121

Answers (1)

ShaneKm
ShaneKm

Reputation: 21368

I was able to get this to work is to add an attribute:

[Timeout("05:00:00")]
[FunctionName("MyFunction")] 

Seems host.json file is being ignored

EDIT - Fix with HOST.JSON file

Found this thread: https://github.com/Azure/azure-functions-servicebus-extension/issues/81

Solution: https://github.com/Azure/azure-functions-servicebus-extension/issues/34#issuecomment-596781972

public override void Configure(IFunctionsHostBuilder builder)
        {
            var tempServices = builder.Services.BuildServiceProvider();
            var azureFuncConfig = tempServices.GetService<IConfiguration>();
            var configBuilder = new ConfigurationBuilder()
                .AddConfiguration(azureFuncConfig)
                .SetBasePath(Environment.CurrentDirectory)
                .AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
                .AddEnvironmentVariables();

            var configReader = configBuilder.Build();
            var config = configBuilder.AddAzureKeyVault(new AzureKeyVaultConfigurationOptions()
            {
                Client = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(new AzureServiceTokenProvider().KeyVaultTokenCallback)),
                Vault = configReader["keyvaulturl"],
                Manager = new DefaultKeyVaultSecretManager()),
            }).Build();

            builder.Services.AddSingleton<IConfiguration>(config);
        }

Upvotes: 7

Related Questions