Azure Function App - Error: Encountered an error (ServiceUnavailable) from host runtime

Syed Muhammad Hani 25 Reputation points
2023-10-20T17:05:22.9933333+00:00

I am trying to deploy an Azure Function in python to a Function App, but I keep getting this error message in logs. Service Health shows no issue, I've double checked all connection strings, and checked the available solutions which suggest removing WEBSITE_RUN_FROM_PACKAGE from settings. This same function app was previously working fine, started having this issue two days ago.

Logs for the error as as follows:

Syncing triggers...
9:42:56 AM extract-attachment1: Syncing triggers (Attempt 2/6)...
9:43:07 AM extract-attachment1: Syncing triggers (Attempt 3/6)...
9:43:29 AM extract-attachment1: Syncing triggers (Attempt 4/6)...
9:44:11 AM extract-attachment1: Syncing triggers (Attempt 5/6)...
9:45:32 AM extract-attachment1: Syncing triggers (Attempt 6/6)...
9:45:34 AM: Error: Encountered an error (ServiceUnavailable) from host runtime.
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,337 questions
0 comments No comments
{count} vote

Accepted answer
  1. navba-MSFT 17,365 Reputation points Microsoft Employee
    2023-10-23T06:12:42.8733333+00:00

    @Syed Muhammad Hani Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    I understand that you are facing an error while deploying an Azure Function in Python to a Function App. The error message is Encountered an error (ServiceUnavailable) from host runtime. You have already checked the connection strings and removed WEBSITE_RUN_FROM_PACKAGE from settings, but the issue persists.

    Please follow the below action plan for now:

    1. Firstly, ensure that you have followed these pre-requisites in your local dev environment.

    2.Also ensure that the Func Core tools are up to date.

    3.Please check the AzureWebJobsStorage setting in local.settings.json.
    You need to update the value to the Azure Storage connection string:

    DefaultEndpointsProtocol=https;AccountName=<ACCOUNT NAME>;AccountKey=<ACCOUNT KEY>;EndpointSuffix=core.windows.net

    4.Please check if your Storage Account has the Firewall / Vnet / tunnelling enabled ? Could you please change the settings to All Network and check if that helps ? More info **here.
    **
    5.If your FunctionApp has Vnet enabled, check the suggestions here.

    6.The language of your function app is maintained in the FUNCTIONS_WORKER_RUNTIME AppSetting in Azure Function App Portal. Please set python as the value.

    https://learn.microsoft.com/en-us/azure/azure-functions/functions-app-settings#functions_worker_runtime

    7.Please try to deploy using the zip deployment method and check if that helps. You can use the below command to publish your function app:

    func azure functionapp publish <APP_NAME>

    8.Please check the Function App detectors by navigating to the Diagnose and Solve Problems section in the Azure Portal for the Functions as shown below: You can rely on the Function App Down or Reporting Errors setting:
    User's image

    9.Check the Azure Function App's logs to get more information about the error. You can do this by navigating to the Azure portal, selecting the Function App, and then selecting "Logs" from the left-hand menu. Look for any error messages or exceptions that could be causing the issue.

    User's image

    More Info here.

    Hope this helps.

    If none of the above action plan helps, please let me know. I would be happy to assist you further.

    **
    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.


0 additional answers

Sort by: Most helpful