3

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.

0

3 Answers 3

1

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

Sign up to request clarification or add additional context in comments.

Comments

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.

1 Comment

In Azure, I found this setting ineffective solely local.settings.json. Fix is to do this also into function's configuration.
0

The fix described by the others is the most likely reason for this. However, you will also get this error if you're missing dependencies in your requirements.txt file.

Delete & recreate your virtual environment and restart the server locally. If it starts successfully, your dependencies are probably alright.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.