azure - 无法在 Azure 中使用 CosmosDB Binding 作为 SpringBoot App 运行时间触发函数
问题描述
无法打包虚拟应用程序
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource to D:\MyFiles\akarforma\Downloads\hello-spring-function-azure-master\target\azure-functions\spring-mongtotimer
[INFO] Copied successfully.
[INFO] Step 7 of 7: Installing function extensions if needed
Extensions command requires dotnet on your path. Please make sure to install dotnet (.NET Core SDK) for your system from https://www.microsoft.com/net/download
[ERROR]
[ERROR] Failed to install the Function extensions
[INFO] ---------------------------------------------------
并在将其发布到 Azure 后
错误:
Function (spring-mongtotimer/hellodummy) Error: The binding type(s) 'cosmosDB' are not registered. Please ensure the type is correct and the binding extension is installed.
@FunctionName("helloTimer")
public void execute(@TimerTrigger(name = "timerInfo", schedule = "*/1 * * * * *") String timerInfo,@CosmosDBInput(name = "documents", databaseName = "db1", collectionName = "col1", connectionStringSetting = "dbStr") Optional<String>documents,ExecutionContext context){
解决方案
似乎为了生成包,您需要dotnet
CLI。您收到的错误是因为您生成的包不包含扩展(Cosmos DB 是一个扩展):
Extensions command requires dotnet on your path. Please make sure to install dotnet (.NET Core SDK) for your system from https://www.microsoft.com/net/download
[ERROR]
[ERROR] Failed to install the Function extensions
您是否使用最新的 Azure Functions CLI?
推荐阅读
- php - 文件名已插入数据库,但文件未到达目标文件夹
- wordpress - Woocommerce:如何为每个产品变体显示具有不同内容的表格?
- azure - 从我的天蓝色函数中检索主机密钥
- javascript - 无法为linkedIn 生成访问令牌
- function - 我在 PowerShell 函数参数上做错了什么?
- elasticsearch - 在没有索引排序的情况下使用 Search After
- algorithm - 基于寄存器的编译器中递归函数的性能
- python - pipenv 在 pipfile 中指定 python 的最低版本?
- javascript - 如果某个键的值可能为空,则解构对象
- php - Facebook 将照片上传到时间线