Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CosmosDB lease container appears inoperable #175

Open
ptdel opened this issue Jul 27, 2021 · 0 comments
Open

CosmosDB lease container appears inoperable #175

ptdel opened this issue Jul 27, 2021 · 0 comments

Comments

@ptdel
Copy link

ptdel commented Jul 27, 2021

In my code I have the following Cosmosdb change-feed function:

                    .CosmosDb("cosmosDbConnection", cosmos => cosmos
                        .ChangeFeedFunction<UpdatePerspectiveGroupJob>(
                            "[scrubbed]",
                            "[scrubbed]",
                            leaseDatabaseName: "[scrubbed]",
                            createLeaseCollectionIfNotExists: true,
                            convertToPascalCase: true)));

providing both the leaseDatabaseName as well as the createLeastCollectionIfNotExists to ensure that the leases collection is created if it is not already there. However with these parameters specified I encounter this error:

[2021-07-27T17:26:41.687Z] The listener for function 'CosmosFnUpdatePerspectiveGroupJob' was unable to start. Microsoft.Azure.WebJobs.Extensions.CosmosDB: Either the source collection '[scrubbed]' (in database '[scrubbed]')  or the lease collection 'leases' (in database '[scrubbed]) does not exist. Both collections must exist before the listener starts. To automatically create the lease collection, set 'CreateLeaseCollectionIfNotExists' to 'true'. Microsoft.Azure.DocumentDB.Core: Message: {"Errors":["Resource Not Found. Learn more: https:\/\/aka.ms\/cosmosdb-tsg-not-found"]}

If I manually create the leases collection in my database all is well, but it looks like passing these parameters doesn't mean that function monkey will attempt to create the leases collection itself when building.
(sorry for the scrubbing, it's for a client with a well-known name. I checked and validated that both the database and containers do exist and are correctly named.)

As a side note: I don't intend for this function to need leases as no other function would be triggered by a change to cosmos, but even without this information provided to the change-feed function it still coughs. I referred to the following documentation to create the function https://functionmonkey.azurefromthetrenches.com/guides/cosmos/changeFeed.html which didn't mention anything about utilizing leases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant