Azure DocumentDB Owner resource does not exist
Solution 1
Owner resource does not exist
occurs when you have given a wrong database name.
For example, while reading a document with client.readDocument(..)
, where the client is DocumentClient
instance, the database name given in docLink
is wrong.
Solution 2
This error for sure appears to be related to reading a database/collection/document which does not exist. I got the same exact error for a database that did exist but I input the name as lower case, this error appears to happen regardless of your partition key.
The best solution I could come up with for now is to wrap the
var response = await client.ReadDocumentAsync(UriFactory.CreateDocumentUri(database, collection, "documentid"));
call in a try catch, not very elegant and I would much rather the response comes back with some more details but this is Microsoft for ya.
Something like the below should do the trick.
Model myDoc = null;
try
{
var response = await client.ReadDocumentAsync(UriFactory.CreateDocumentUri(database, collection, document));
myDoc = (Model )(dynamic)response.Resource;
}
catch { }
if (myDoc != null)
{
//do your work here
}
That is to get a better idea of the error then create the missing resource so you dont get the error anymore.
A few resources I had to go through before coming to this conclusion: https://github.com/DamianStanger/DocumentDbDemo
Azure DocumentDB Read Document Resource Not Found
Solution 3
I had the same problem. I found that Visual Studio 2017 is publishing using my Release configuration instead of the Test configuration I've selected. In my case the Release configuration had a different CosmosDB database name that doesn't exist, which resulted in the "owner resource does not exist" error when I published to my Azure test server. Super frustrating and a terrible error message.
user1301722
Updated on March 27, 2020Comments
-
user1301722 over 4 years
I having the same error icrosoft.Azure.Documents.DocumentClientException: Message: {"Errors":["Owner resource does not exist"]} , this is my scenario. When I deployed my webapp to Azure and try to get some document from docDb it throws this error. The docdb exists in azure and contains the document that i looking for.
The weird is that from my local machine(running from VS) this works fine. I'm using the same settings in Azure and local. Somebody have and idea about this.
Thanks
-
Chris B. Behrens over 6 yearsNote: it appears that database name is CASE-SENSITIVE. This was my problem.
-
ebhh2001 almost 5 yearsThe correct database name and container name are shown in Azure Portal / <your Cosmos DB> / Overview