我正在使用 cosmos db 触发器创建一个 azure 函数,我使用了 Visual Studio Code azure 工具来创建它,它生成了以下代码:
public static class offers_trigger
{
[Function("items_trigger")]
public static void Run([CosmosDBTrigger(
databaseName: "dev",
collectionName: "items",
ConnectionStringSetting = "dev_DOCUMENTDB",
LeaseCollectionName = "leases")] IReadOnlyList<MyDocument> input, FunctionContext context)
{
var logger = context.GetLogger("items_trigger");
if (input != null && input.Count > 0)
{
logger.LogInformation("Documents modified: " + input.Count);
logger.LogInformation("First document Id: " + input[0].Id);
}
}
}
但是当我尝试在本地启动它时,它会产生以下错误:
The listener for function 'Functions.items_trigger' was unable to start. Microsoft.Azure.DocumentDB.Core: Sql api is not supported for this database account
ActivityId: 773dae99-5e4e-45f7-a54f-4c5b0dbaf5a8, Microsoft.Azure.Documents.Common/2.14.0, Darwin/10.15 documentdb-netcore-sdk/2.12.0.
任何人都可以帮助我吗?