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.