在没有任何代码更改的情况下升级到 1.0.1 CLI 工具后,我突然开始收到以下错误:
ResizeImage: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.ResizeImage'.
Microsoft.Azure.WebJobs.Extensions.DocumentDB:
'Id' is required when binding to a DocumentClient property.
以下代码:
[FunctionName(nameof(ResizeImage))]
public static async Task RunAsync([BlobTrigger("profile-pictures/{name}")] CloudBlockBlob myBlob, string name, [DocumentDB(databaseName: "x", collectionName: "UserProfile", CreateIfNotExists = true)] DocumentClient client, [Blob("profile-pictures/resized-{name}", FileAccess.ReadWrite)] CloudBlockBlob resizedBlob, TraceWriter log)
我以为 ID 是可选的?至少文档是这么说的。
根据文档:
属性 id 和 sqlQuery 不能同时指定。如果既没有设置 id 也没有设置 sqlQuery,则检索整个集合。
生成的json:
{
"bindings": [
{
"type": "blobTrigger",
"path": "profile-pictures/{name}",
"direction": "in",
"name": "myBlob"
},
{
"type": "documentDB",
"databaseName": "x",
"collectionName": "UserProfile",
"createIfNotExists": true,
"direction": "out",
"name": "client"
},
{
"type": "blob",
"path": "profile-pictures/resized-{name}",
"direction": "inout",
"name": "resizedBlob"
}
],
"disabled": false,
"scriptFile": "..\\X.Functions.dll",
"entryPoint": "X.Functions.ResizeImage.RunAsync"
}
我正在使用 1.0.0 SDK