I am trying to deploy an time triggered (schedule) function to azure function using the python v2 model. The function works as expected locally. I am deploying using VSCode and Azurite extension. The deployment seems to be successful, however it says that "No HTTP triggers found" (which does not make any sense because it is not an HTTP triffered function), and the function is in fact not deployed to Azure. What could be wrong here?
function_app.py
import azure.functions as func
import datetime
import logging
import requests
import json
import sys
import os
CRON_SCHEDULE = "*/10 * * * * *"
app = func.FunctionApp()
@app.function_name(name="testSendReqToApiTimeTrigger")
@app.schedule(schedule=CRON_SCHEDULE, arg_name="mytimer", run_on_startup=False, use_monitor=True)
def makeApiCall(mytimer: func.TimerRequest, context: func.Context) -> None:
if mytimer.past_due:
logging.info('The timer is past due!')
logging.info('.context_func_dir: ' + context.function_directory)
url = "http://worldtimeapi.org/api/timezone/Europe/Amsterdam"
try:
response = requests.get(url)
print(f"request completed with status code: {response.status_code}")
except:
logging.error("ERROR during sending request : ")
logging.error(str(sys.exc_info()))
The last few lines of the output of the deployment process:
...
11:24:06 AM test-timer-function: Deployment successful. deployer = ms-azuretools-vscode deploymentPath = Functions App ZipDeploy. Extract zip. Remote build.
11:24:20 AM test-timer-function: Syncing triggers...
11:24:29 AM test-timer-function: Querying triggers...
11:24:34 AM test-timer-function: No HTTP triggers found.