内部错误:创建 Azure Functions 项目时,预期值既不为 null 也不未定义:functionName。
我正在按照此处提到的步骤操作:https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/ai-services/document-intelligence/tutorial-azure-function.md
一切似乎都按照上述链接中提到的方式进行,但我仍然收到此错误。请帮忙。
我正在尝试使用 Microsoft 的文档智能和 blob 存储来自动化文档处理。当我创建 Azure 项目时,出现此错误。是否与Azure核心工具的安装有关?我对 python 或 azure 没有太多背景,所以我可能犯了一个非常简单的错误。
内部错误:创建 Azure Functions 项目时,预期值既不为 null 也不未定义:functionName。
上述错误表明您在创建 Azure Functions 项目期间传递的配置或参数可能存在问题,也可能与 Azure 核心工具的安装和不正确的配置设置有关。
npm install -g azure-functions-core-tools@latest
命令来更新最新版本的 azure function core 工具。我已经尝试了文档中提到的相同步骤,达到了预期的功能。
功能代码:
import logging
from azure.functions import InputStream
def main(myblob: InputStream):
logging.info(f"Python blob trigger function processed blob \n"
f"Name: {myblob.name}\n"
f"Blob Size: {myblob.length} bytes")
Function.json:
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "myblob",
"type": "blobTrigger",
"direction": "in",
"path": "pavan/sample.txt",
"connection": "pavanstoragehello_STORAGE"
}
]
}
local.settings,json:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "python",
"pavanstoragehello_STORAGE": "your-storage conn-string"
}
}
输出: