I’m deploying a Python application as an Azure Functions App through a zip deployment. The project structure looks like this:
src/
├── lib
├── modules
├── __init__.py
└── trivy/
├── __init__.py
├── fetch_release.py
├── send_notification.py
├── main.py
└── adaptive_card_template.json
├── __init.py__
├── .funcignore
├── function_app.py
├── host.json
├── requirements.txt
└── local.settings.json
pyproject.toml
poetry.lock
where I only zip the src folder as it is the root of the Functions project.
The problem I am facing is that after running the following az command:
az functionapp deployment source config-zip --src ./dist/dependency-webhook-api.zip --resource-group ${AZURE_APP_RG} --name ${AZURE_APP_NAME} --subscription ${AZURE_APP_SUBSCRIPTION} --timeout 180
The result indicates that the operation is a success, however the Function app does not display any functions on its GUI:
| It has to be noted that I successfully ran the application locally using func start
These are the most important files:
function_app.py
# The function_app.py file is the main Azure functions initializer,
# here the app object gets created, and other functions,
# get registered to it.
import azure.functions as func
# Imports of azure functions from modules:
from modules.trivy.main import trivy_module
# Init the azure functions app
app = func.FunctionApp()
# Register azure functions from modules
app.register_functions(trivy_module)
host.json
{
"version": "2.0",
"logging": {
"logLevel": {
"default": "Warning",
"Host.Aggregator": "Trace",
"Host.Results": "Information",
"Function": "Information"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
}
}
modules/trivy/main.py
import azure.functions as func
import logging
from lib.utils import ReleaseMode, newer_version_available
from .fetch_release import fetch_release_data
from .send_notification import send_notification
trivy_module = func.Blueprint()
@trivy_module.function_name(name="trivy_module")
@trivy_module.timer_trigger(
schedule="0 12 * * 1", arg_name="timer", run_on_startup=True
)
def main(timer: func.TimerRequest):
logging.info("Trivy module triggered.")
response = fetch_release_data()
logging.info("Trivy release data fetched.")
if newer_version_available(ReleaseMode.MINOR_MODE, "v0.48.0", response["tag_name"]):
send_notification(response)
logging.info("Trivy notification update sent.")
If I run the az functionapp with the --build-remote true
parameter, this is the output:
If anyone has any idea how I can debug this deployment to see any type of error or why the application won’t start as needed, your help would be much appreciated!