输入绑定到自定义 class 似乎不适用于 blob

Input binding to custom class doesn't seem to work for blob

我的 Azure 函数有两个输入参数:

我正在尝试将这两个参数绑定到自定义类型(在我的例子中是 F# 记录)。触发器绑定工作正常,但博客绑定无效,这会产生以下错误:

Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.MailboxFanOut'. 
Microsoft.Azure.WebJobs.Host: Can't bind Blob to type 'Run+CustomerName'.

代码如下:

[<CLIMutable>]
type CustomerName = {
    UserName: string
}

let Run(item: CustomerName, userNames: CustomerName, log: TraceWriter) =
    log.Verbose("F# function executing")

用 class 替换 F# 记录没有帮助...

函数定义如下:

{
  "bindings": [
    {
      "type": "eventHubTrigger",
      "name": "item",
      "direction": "in",
      "path": "blabla",
      "connection": "eventhubs",
      "consumerGroup": "$Default"
    },
    {
      "type": "blob",
      "name": "userNames",
      "path": "tada/123",
      "connection": "foo",
      "direction": "in"
    }
  ],
  "disabled": false
}

不幸的是,blob 绑定目前并不像您期望的那样支持 POCO 绑定。我们的回购中有一个未解决的问题跟踪这个 here

要解决这个问题,我建议绑定到流、字符串或其他受支持的类型之一,并在您的方法中将反序列化为您的 POCO 类型。