Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a valid binding name for azure function?

When I try to run the azure function defined below, I get the following error log

The 'my_function' function is in error: The binding name my_function_timer is invalid. Please assign a valid name to the binding.

What is the format of a valid binding name for Azure Function ?

Function definition

I have two files in my_function directory:

  • __init__.py contains the python code of the function
  • function.json contains the configuration of the function

Here is the content of those two files

__init__.py

import azure.functions as func
import logging

def main(my_function_timer: func.TimerRequest) -> None:
    logging.info("My function starts")
    print("hello world")
    logging.info("My function stops")

function.json

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "my_function_timer",
      "type": "timerTrigger",
      "direction": "in",
      "schedule": "0 0 1 * * *"
    }
  ]
}

I deploy this function using Azure/functions-action@v1 github action

like image 698
Vincent Doba Avatar asked Dec 14 '25 04:12

Vincent Doba


1 Answers

I couldn't find anything in the documentation either, but looking at the source code of azure-functions-host(which contains code for the runtime host used by the Azure Functions service), it uses following regex to validate the binding name.

^([a-zA-Z][a-zA-Z0-9]{0,127}|\$return)$

This means that, for a valid binding name

  • First character must be a letter and can be followed by letters or digits(at most 127 characters).

    OR

  • Literal string $return

Since your binding name contains an underscore(_), the above regex does not match which will result in validation error.

like image 194
Abdul Niyas P M Avatar answered Dec 16 '25 20:12

Abdul Niyas P M



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!