Elfocrash / Cosmonaut

🌐 A supercharged Azure CosmosDB .NET SDK with ORM support
https://cosmonaut.readthedocs.io
MIT License
342 stars 44 forks source link

Exceition: FindAsync returning Resource Not Found #120

Open indulismisins opened 4 years ago

indulismisins commented 4 years ago

Hi,

Method FindAsync could not find record by Id value. When I execute this line of code: var workflow = await _cosmosStore.FindAsync(command.WorkflowId, new PartitionKey("id"));

I'm getting error: Executed 'ProcessWorkflows' (Failed, Id=dd9ea974-a1b5-4475-a4da-583a20ea7f5b) [19.12.2019 08:40:20] System.Private.CoreLib: Exception while executing function: ProcessWorkflows. Microsoft.Azure.Cosmos.Client: Response status code does not indicate success: 404 Substatus: 0 Reason: ({ [19.12.2019 08:40:20] "Errors": [ [19.12.2019 08:40:20] "Resource Not Found" [19.12.2019 08:40:20] ] [19.12.2019 08:40:20] }).

When I execute this line of code: var workflows = _cosmosStore.Query(allowSynchronousQueryExecution: true).Where(w => w.Id == command.WorkflowId).ToList();

I'm getting one item. In both runs command.WorkflowId value is same. I'm using 3.0.0-preview1 version.

Elfocrash commented 4 years ago

This line: var workflow = await _cosmosStore.FindAsync(command.WorkflowId, new PartitionKey("id")); needs to be: var workflow = await _cosmosStore.FindAsync(command.WorkflowId, new PartitionKey(command.WorkflowId));