Deploy function from VS code to function app in Azure: No HTTP triggers found.
I have been trying to deploy a simple function in VS code to my function app in Azure. I keep getting the message No HTTP triggers found. and the function does not show up in Azure. I have already reviewed all other posts with the same error and none of the suggestions worked for me.
I created the app function in Azure Portal
- Hosting plan: Consumption
- Operating system: Linux
- Runtime stack: python
- Version: 3.11
In VS code, I created an empty folder
-
Azure Functions: Create New Project
- Selected folder
- Selected python
- Selected HTTP trigger template
- Python interpreter: 3.11
- Authorization level: FUNCTION
Now I have the base template project created, completely unchanged and want to deploy to Azure
function_app.py:
import azure.functions as func
app = func.FunctionApp(http_auth_level=func.AuthLevel.FUNCTION)
@app.route(route="test_http")
def test_http(req: func.HttpRequest) -> func.HttpResponse:
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
)
host.json
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
}
}
local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "python"
}
}
requirements.txt
azure-functions
Output:
3:53:17 PM sadek-func-app: Creating zip package...
3:53:17 PM sadek-func-app: Adding 4 files to zip package...
3:53:17 PM sadek-func-app: /Users/youssefawad/Projects/Azure/test_func/.funcignore
3:53:17 PM sadek-func-app: /Users/youssefawad/Projects/Azure/test_func/function_app.py
3:53:17 PM sadek-func-app: /Users/youssefawad/Projects/Azure/test_func/host.json
3:53:17 PM sadek-func-app: /Users/youssefawad/Projects/Azure/test_func/requirements.txt
3:53:17 PM sadek-func-app: Zip package size: 1.29 kB
3:53:19 PM sadek-func-app: Fetching changes.
3:53:20 PM sadek-func-app: Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/d56ac252-cd75-4eed-8554-4c49553d4795.zip (0.00 MB) to /tmp/zipdeploy/extracted
3:53:22 PM sadek-func-app: Updating submodules.
3:53:23 PM sadek-func-app: Preparing deployment for commit id 'fcdc4fb4-9'.
3:53:23 PM sadek-func-app: PreDeployment: context.CleanOutputPath False
3:53:23 PM sadek-func-app: PreDeployment: context.OutputPath /home/site/wwwroot
3:53:23 PM sadek-func-app: Repository path is /tmp/zipdeploy/extracted
3:53:23 PM sadek-func-app: Running oryx build...
3:53:23 PM sadek-func-app: Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.11 -p packagedir=.python_packages/lib/site-packages
3:53:23 PM sadek-func-app: Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
3:53:23 PM sadek-func-app: You can report issues at https://github.com/Microsoft/Oryx/issues
3:53:23 PM sadek-func-app: Oryx Version: 0.2.20230210.1, Commit: a49c8f6b8abbe95b4356552c4c884dea7fd0d86e, ReleaseTagName: 20230210.1
3:53:23 PM sadek-func-app: Build Operation ID: 77531de334028de6
3:53:23 PM sadek-func-app: Repository Commit : fcdc4fb4-98bf-4976-b48b-3283371dba9b
3:53:23 PM sadek-func-app: OS Type : bullseye
3:53:23 PM sadek-func-app: Image Type : githubactions
3:53:23 PM sadek-func-app: Detecting platforms...
3:53:24 PM sadek-func-app: Detected following platforms:
3:53:24 PM sadek-func-app: python: 3.11.12
3:53:24 PM sadek-func-app: Version '3.11.12' of platform 'python' is not installed. Generating script to install it...
3:53:35 PM sadek-func-app: Syncing triggers...
3:53:38 PM sadek-func-app: Querying triggers...
3:53:40 PM sadek-func-app: No HTTP triggers found.
I tried looking through "Functions that are not triggering" in "Diagnose and solve problems" but that did not help
I tried turning on Application Insights to look at the Log Stream but there was nothing helpful there.
I cannot figure out why it's not working. I have created the function app like the documentation says and created the project in VS code exactly as the template provided.
Any help would be greatly appreciated