node.jsazuredeploymentazure-functions

Azure function app (v4 / node.js) no functions found after zip deployment


I have deployed a function app and there are no functions visible:

No functions found

In Kodu what I can see seems correct (the files are under wwwroot):

function app debugger

In the app files tab. I can see two folder separators that I'm guessing this could be the problem:

App files

I have WEBSITE_RUN_FROM_PACKAGE disabled and I'm deploying with:

az functionapp deployment source config-zip -g <resource-group> -n <app-name> --src ./deploy.zip

Solution

  • After trying millions of things, this is what did it for me:

    My folder structure is the following:

    dist <-- this folder is present if you use TypeScript
    │   └── src
    │       ├── dal
    │       ├── functions
    │       │    └── <MY FUNCTIONS ARE HERE>
    │       └── shared
    ├── host.json
    └── package.json
    

    One of my changes was in the host.json:

      // ...
      "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[4.0.0, 5.0.0)" <-- upgraded the version
      }
    

    Another thing I did was to upgrade everything (Azure CLI, function core tools, etc.).

    And finally, I saw this in the docs:

    During preview, the v4 model requires you to set the app setting AzureWebJobsFeatureFlags to EnableWorkerIndexing. For more information, see Enable v4 programming model.

    To create it I needed to run:

    az functionapp config appsettings set --name <FUNCTION_APP_NAME> \
    --resource-group <RESOURCE_GROUP_NAME> \
    --settings AzureWebJobsFeatureFlags=EnableWorkerIndexing
    

    Then I restarted the function app and it finally worked.