azure-functions-host
azure-functions-host copied to clipboard
Timer Trigger arg_name cannot use snake case
Investigative information
func --version
4.0.5530
Repro steps
Provide the steps required to reproduce the problem:
- Create a new Azure function
func new --template "Timer Trigger" --name another_trigger
- Change the generated code from
@app.timer_trigger(schedule="0 */5 * * * *", arg_name="myTimer", run_on_startup=True,
use_monitor=False)
def another_trigger(myTimer: func.TimerRequest) -> None:
to
@app.timer_trigger(schedule="0 */5 * * * *", arg_name="my_timer", run_on_startup=True,
use_monitor=False)
def another_trigger(my_timer: func.TimerRequest) -> None:
- Run the function, which results in an error of the form:
The 'another_trigger' function is in error: The binding name my_timer is invalid. Please assign a valid name to the binding.
Expected behaviour
It should be possible to use a binding name that uses snake case, since this is the normal convention for Python programs.
Actual behaviour
The 'another_trigger' function is in error: The binding name my_timer is invalid. Please assign a valid name to the binding.
Known workarounds
Remove the _
character from the binding and variable name.
Contents of the requirements.txt file:
azure-functions==1.18.0
Thanks for reporting will check and update.Thanks
Hi @williamhbell pls have a look this is not supported.https://github.com/Azure/azure-functions-python-worker/issues/1174
@bhagyshricompany thanks for spotting Azure/azure-functions-python-worker#1174. It appears to be the same bug. As mentioned in Azure/azure-functions-python-worker#1174, snake case is normally used for Python variables following PEP8 https://peps.python.org/pep-0008/#function-and-variable-names .
yes but right now not have support.
the validation is done in azure functions host at https://github.com/Azure/azure-functions-host/blob/1ed94659541864f111cc01f4db9480d64132140c/src/WebJobs.Script/Utility.cs#L60.
Transferring to Azure Function Host to continue the discussion