我遵循以下结构,但上传功能应用程序后,我遇到错误:
错误:
函数(转换/EventHubTrigger1)错误:Microsoft.Azure.WebJobs.Host:索引方法“Functions.EventHubTrigger1”出错。 Microsoft.Azure.WebJobs.EventHubs:值不能为空。 (参数“receiverConnectionString”)。 session ID:cb179cdab03c4e8c80f1f82d9da9d143
时间戳:2020-03-11T15:55:55.575Z
<小时/>Function.json :
{
"scriptFile": "__init__.py",
"bindings": [
{
"type": "eventHubTrigger",
"name": "event",
"direction": "in",
"eventHubName": "iothub-ehub-neas-hub-xxx-xxxx",
"connection": "Endpoint=sb://xxxxxxxxxxxx.servicebus.windows.net/;SharedAccessKeyName=iothubowner;SharedAccessKey=xxxxxxxxxxx=;EntityPath=iothub-ehub-neas-hub-xxxxxx-856659355a",
"cardinality": "many",
"consumerGroup": "$Default"
}
]
}
最佳答案
您需要将端点信息放入 local.settings.json 中并从 function.json 中引用它。 XXXX只是为了显示更多。连接字符串是您在事件中心门户中获得的内容。我在节点中设置时遇到了同样的问题。
Local.settings.json
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "node",
"AzureEventHubConnectionString": "Endpoint=XXXX",
"AzureWebJobsStorage": "DefaultEndpointsProtocol=XXXX"
}
}
然后在你的 function.json 中
{
"bindings": [
{
"type": "eventHubTrigger",
"name": "IoTHubMessages",
"direction": "in",
"eventHubName": "<event hub name you have>",
"connection": "AzureEventHubConnectionString",
"cardinality": "many",
"consumerGroup": "$Default"
}
]
}
这将消除 receiveConnectionString 错误。
关于python - Azure函数应用程序: Microsoft. Azure.WebJobs.EventHubs : Value cannot be null.(参数 'receiverConnectionString'),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60640205/