Javascript Azure持久功能(Node.JS)错误“Microsoft.Azure.WebJobs.Host:无法将参数'data'绑定到类型'System.String'

Javascript Azure持久功能(Node.JS)错误“Microsoft.Azure.WebJobs.Host:无法将参数'data'绑定到类型'System.String',javascript,node.js,azure,azure-functions,azure-durable-functions,Javascript,Node.js,Azure,Azure Functions,Azure Durable Functions,我正在运行一组在Azure Function App平台上编写的持久函数Node.js。 节点版本为10,函数运行时版本为2。 其中一些已配置触发器: "bindings": [ { "authLevel": "anonymous", "type": "httpTrigger", "direction": "in", "name": "req", "methods": [ "post" ]

我正在运行一组在Azure Function App平台上编写的持久函数Node.js。 节点版本为10,函数运行时版本为2。 其中一些已配置触发器:

  "bindings": [
    {
      "authLevel": "anonymous",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": [
        "post"
      ]
    },


{
  "bindings": [
    {
      "name": "name",
      "type": "activityTrigger",
      "direction": "in"
    }
  ],
  "scriptFile": "../.../index.js"
}
从昨天开始,函数在尝试打开时显示以下错误:

Function (func4/Create) Error: Microsoft.Azure.WebJobs.Host: Error indexing method  
 'Functions.Create'. Microsoft.Azure.WebJobs.Host: Can't bind parameter 'data' to type  
 'System.String'.
    Session Id: 9b3d1a97c12b4c86b751b08ab17c06da

Timestamp: 2019-12-11T19:04:49.345Z
我不知道是什么导致了这种行为。 Kudu日志也充满了相同的错误,但没有详细信息

更新的依赖项:

请注意,Azure持久函数不支持typescript

如果您使用JavaScript,它可以支持Azure持久功能

看一看这个

问题出在data Non中,它似乎是Azure函数中的保留字。 当我将名称从data更改为另一个上下文时,错误消失了:

{
  "bindings": [
    {
      "name": "context",
      "type": "activityTrigger",
      "direction": "in"
    }
  ],
  "scriptFile": "../dist/Container/index.js"
}

不幸的是,我在尝试测试不同的假设时得到了线索

如果您检查初始post,函数运行时为2。此外,尽管函数是用typescript编写的,但typescript编译器是在部署之前执行的,部署文件是纯js文件。此错误在任何情况下都不会连接到程序集。@Sergey很抱歉没有注意到您的运行时版本,我修改了答案。但是,请注意,您的函数仍然是用typescript编写的。你以前有没有用typescript写过持久的函数?除非文档有问题,否则除了C、JavaScript和F之外编写的azure函数应用程序应该无法实现持久功能。Python也不支持持久函数。请看。Typescript在编译为Javascript时作为GA for 2.x运行时受支持,通过转换为Javascript支持。。这正是我运行npm build命令时发生的情况。tsc编译器在'dist'目录中创建纯js文件,然后将其部署到Function App。@Sergey嗨,Sergey。非常感谢您的解释,我对azure持久功能支持的理解可能是错误的。如果你解决了这个问题,你可以把你的答案标记为这个问题的答案。这将帮助其他遇到同样问题的人。感谢您的耐心。对于任何感兴趣的人来说,GitHub似乎也存在一个开放的问题:
{
  "bindings": [
    {
      "name": "context",
      "type": "activityTrigger",
      "direction": "in"
    }
  ],
  "scriptFile": "../dist/Container/index.js"
}