2

I have created a very simple Python V2 programming model HttpTrigger, which works fine on my machine in the Azure function runtime locally.

But when I "deploy" it to an Azure function app (Python v2 programming model), I do not see any functions listed as being registered. And calling out to the corresponding hosted URL route doesn't work, though the top-level Azure function app is returning its homepage indicating Azure thinks the hosting runtime is running. The function app exists (and it works from a URL at its root), but no functions are listed in the app. Deployment gives no errors; it says it's successfully deployed, but just isn't listed.

Do other people have this problem? Is there a way to resolve it?

Simple function app:

@app.function_name(name="HttpTrigger1")
@app.route(route="hello")
def test_function(req: func.HttpRequest) -> func.HttpResponse:
     logging.info('Python HTTP trigger function processed a request.')

     name = req.params.get('name')
     if not name:
        try:
            req_body = req.get_json()
        except ValueError:
            pass
        else:
            name = req_body.get('name')

     if name:
        return func.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
     else:
        return func.HttpResponse(
             "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
             status_code=200
        )

I'll likely try DevOps pipeline deployment next, but I prefer the simplicity of deployment straight from VS Code. I've deployed Typescript functions successfully before. I might try the old V1 model for this python project, but would prefer not to backtrack to that.

If it matters, I'm using VS Code from Mac OSX. Python version 3.9.

user61307
  • 195
  • 2
  • 14

2 Answers2

0

For the Python V2 Programming model in Azure Functions, you'll get the empty list of functions when deployed using VS Code or any IDE.

Because as specified in one of my workarounds, we have to add a setting in local.settings.json file i.e., AzureWebJobsFeatureFlags: EnableWorkerIndexing.

enter image description here

Also, I have given explanation why that setting should be added before deploying for Python Programming model on this SO Thread.

If it matters, I'm using VS Code from Mac OSX. Python version 3.9.

There are some limitations coming to local development of Azure Functions Python-based on different OS (Windows, Mac OS), refer to this MS doc for more information.

  • In Azure, I found this setting ineffective solely `local.settings.json`. Fix is to do this also into function's configuration. – Jari Turkia Jul 05 '23 at 19:44
0

I just had exactly the same symptoms and it's because there was an entry missing from the requirements.txt. The business with AzureWebJobsFeatureFlags seems to be sorted automatically

Andy
  • 10,412
  • 13
  • 70
  • 95