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.