Search code examples
javaazure-functionsazure-functions-runtimeazure-functions-core-tools

Java Azure Functions throws error during running locally - A host error has occurred during startup operation


I have created a azure function in java created Using Command line by following below given Microsoft guide https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-java

I have followed all the steps, but while running function locally using command as attached in below screenshot. Running function locally

I am getting the following error:

error

Anyone please help me in resolving the above error to run the azure function locally.

Thanks & Regards, Preethi H R


Solution

    • This might be the known bug in the azure function extension bundle. So a work around for that, in your project remove the following code from the host.json file
    "extensionBundle": {
    
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    
    "version": "[3.*, 4.0.0)"
    
    }
    

    enter image description here

    • Then restart the project with the following command
     mvn -e  azure-functions:run
    

    enter image description here

    Refer the work around given in this question