Vin*_*oba 9 python azure azure-functions
当我尝试运行下面定义的 azure 函数时,我收到以下错误日志
The 'my_function' function is in error: The binding name my_function_timer is invalid. Please assign a valid name to the binding.
Run Code Online (Sandbox Code Playgroud)
Azure Function 的有效绑定名称的格式是什么?
我的目录中有两个文件my_function
:
__init__.py
包含函数的Python代码function.json
包含功能的配置这是这两个文件的内容
__init__.py
The 'my_function' function is in error: The binding name my_function_timer is invalid. Please assign a valid name to the binding.
Run Code Online (Sandbox Code Playgroud)
function.json
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")
Run Code Online (Sandbox Code Playgroud)
我使用Azure/functions-action@v1 github 操作部署此函数
Abd*_*P M 15
我在文档中也找不到任何内容,但查看azure-functions-host的源代码(其中包含Azure Functions 服务使用的运行时主机的代码),它使用以下正则表达式来验证绑定name
。
^([a-zA-Z][a-zA-Z0-9]{0,127}|\$return)$
Run Code Online (Sandbox Code Playgroud)
这意味着有效的绑定名称必须是:
字母数字字符(最多 127 个字符)
或者
文字字符串$return
由于您的绑定名称包含下划线( _
),因此上述正则表达式不匹配,这将导致验证错误。
归档时间: |
|
查看次数: |
3776 次 |
最近记录: |