python - Azure 函数 python 命名参数没有值

标签 python triggers azure-functions azure-blob-storage

我目前正在 azure 函数中使用 python 创建一个计时器触发器,该触发器聚合来自 blob 存储的数据,并将结果放入 cosmosDB 中。

我的问题如下:当我在绑定(bind)路径中使用特定文件时,函数按预期运行。每当我更改它(以便获取容器中的所有 blob)时,我都会收到以下错误:

 Microsoft.Azure.WebJobs.Host: No value for named parameter 'test'.

下面是我的 function.json 绑定(bind)

{
  "bindings": [
    {
      "name": "blobTrigger",
      "type": "timerTrigger",
      "direction": "in",
      "schedule": "0 0 * * * *",
      "connnection": "AzureWebJobsStorage",
      "path": "blob/{test}"
     },
     {
       "type": "blob",
       "name": "inputBlob",
       "path": "blob/{test}",
       "connection": "AzureWebJobsStorage",
       "direction": "in"
     },
     {
       "type": "documentDB",
       "name": "outputDocument",
       "databaseName": "database1",
       "collectionName": "functioncollection",
       "createIfNotExists": false,
       "connection": "development_DOCUMENTDB",
       "direction": "out"
      }
    ],
    "disabled": false
}

不确定与存储的连接是否也应该在触发器绑定(bind)中,但是当我在没有它的情况下尝试时,我仍然遇到相同的错误。

你们中有人知道如何解决这个问题吗?

谢谢。

最佳答案

这不是计时器触发器/blob 输入绑定(bind)的合法语法。当您将 blob path 设置为 blob/{test} 时,这意味着您将 blob 路径绑定(bind)到函数触发器中的一条信息。例如。它可用于绑定(bind)到队列消息的属性。

在您的情况下,触发器是计时器,因此它没有可用作 blob 输入绑定(bind)参数的信息。

您无法真正将函数绑定(bind)到容器中的所有 blob。如果您需要一次访问所有 blob,则可能必须手动执行(无需专用绑定(bind),只需使用 SDK)。或者,创建一个将为每个添加/更改的 blob 触发的函数 - 如果您可以一次对一个 blob 进行操作。

关于python - Azure 函数 python 命名参数没有值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47437077/

相关文章:

python - django 的 URL Conf 支持将参数映射到字符串吗?

python - 为什么 "import"是一个语句,而 "reload"是一个函数?

python - Rasa 特工在讲完一个故事后停止回应

错误模式中的mysql触发器问题

azure - 如何在 Azure Functions 中禁用 Application Insights

python - 在 matplotlib 中调整实时绘图(串行数据流)的 x 轴范围

postgresql - Yii 框架和 PostgreSQL 分区表 - 0 行受影响

azure - 在 Azure Durable Functions Orchestrator 中使用异步辅助函数是否安全?

azure-functions - 当 azure 函数输入绑定(bind)到 azure 事件中心时,EventData 数组的大小

WPF TextBox.Text 与 MultiBinding