无法使用SpringBoot App在Azure中使用CosmosDB绑定运行时间触发的功能

时间:2019-08-26 14:22:52

标签: azure spring-boot azure-functions azure-cosmosdb azure-cosmosdb-mongoapi

无法打包虚拟应用程序

[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){

1 个答案:

答案 0 :(得分:0)

似乎要生成软件包,您需要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?