Cannot create Collection Information — error when trying to test Cosmos DB trigger locally

…衆ロ難τιáo~ 提交于 2021-02-10 13:16:12

问题


I am testing out developing an Azure Function to read the change feed of a Cosmos DB database. I have created such a function from the Azure portal, but I would like to use VS or VS Code to do so. I have my environment set up using v2.0.3 of the Azure Function Core Tools, but when I try to test the function, I get the following error:

[10/9/2018 4:33:34 PM] Error indexing method 'Functions.workordersTrigger'

[10/9/2018 4:33:34 PM] Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.workordersTrigger'. Microsoft.Azure.WebJobs.Extensions.CosmosDB: Cannot create Collection Information for workorders in database htm with lease wo_leases in database htm : Entity with the specified id does not exist in the system.

Both collections "workorders" and "wo_leases" exist in the db. If I just create a function with a simple HTTP trigger, it works fine, and I can debug in VS Code. It seems to be an issue with the CosmosDB trigger. Can anyone point me in the right direction?


回答1:


The error message appears if:

  1. Any of the collections do not exist in the target account within the specified database
  2. Your account has a Firewall rule (either Virtual Network or IP rules) that block access to your current workstation.

For #1, verify if the Connection String is pointing to the correct account and that you can see the collections exist within the database (for this you can use the Azure Portal or browse Cosmos Explorer with your connection string).

For #2, verify in the Account there is a rule blocking your access. You can either disable the Firewall rule or add your current IP address (there is a quick link for that in the Portal).



来源:https://stackoverflow.com/questions/52725891/cannot-create-collection-information-error-when-trying-to-test-cosmos-db-trig

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!