Azure函数python命名参数无值 [英] Azure functions python no value for named parameter

查看:80
本文介绍了Azure函数python命名参数无值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am currently using python in azure functions to create a timer trigger that aggregates data from blob storage, and puts the result in cosmosDB.

我的问题如下:当我在绑定路径中使用特定文件时,功能将按预期运行.每当我更改它(以便吸收容器中的所有斑点)时,都会出现以下错误:

My problem is as follows: When I use a specific file in the path binding the functions runs as expected. Whenever I change it (so as to take all blobs in the container) I get the following error:

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

下面是我的function.json绑定

Below is my function.json bindings

{
  "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
}

不确定是否也应该在触发器绑定中建立与存储的连接,但是当我尝试不使用它时,我仍然会遇到相同的错误.

Unsure if connection to storage is supposed to be in the trigger binding also, but when ive tried without it i still get the same error.

你们中的任何人有解决该问题的想法吗?

Do any of you have any idea how to solve this?

谢谢.

推荐答案

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

This is not a legal syntax for timer trigger / blob input binding. When you set blob path to blob/{test}, that means you are binding blob path to a piece of information from your function's trigger. E.g. it could be used to bind to a property of queue messages.

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

In your case, the trigger is timer, so it has no information with it that could be used as parameter for blob input binding.

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

You can't really bind your function to ALL blobs in a container. If you need to access all blobs at once, you might have to do it manually (without dedicated binding, just by using SDK). Alternatively, create a function which will be triggered for each added/changed blob - if you can operate on one blob at a time.

这篇关于Azure函数python命名参数无值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆