PartitionKey has fewer components than defined the collection resource. - On Azure not Local
See original GitHub issueDescribe the bug Performing a query similar to the below on a set of records. Container’s partition key is /pk . Documents have been stored as having PartitionKey.None (its a very small container). Query is performed using PartitionKey.None:
QueryDefinition query = new QueryDefinition("SELECT TOP 1 h.slug FROM h WHERE ARRAY_CONTAINS(h.knownDomains, @domain)")
.WithParameter("@domain", domain);
QueryRequestOptions queryOptions = new QueryRequestOptions()
{
MaxItemCount = 1,
PartitionKey = PartitionKey.None
};
This code works in local debugging in Debug or Release modes. When deployed to Azure Functions, the behavior changes and the following exception is encountered: PartitionKey has fewer components than defined the collection resource.
I have changed deployment methods, suspecting nuget package differences but did not solve.
Expected behavior Identical functionality in local and on Azure, for PartitionKey.None to be accepted.
Actual behavior PartitionKey has fewer components than defined the collection resource encountered in Azure Functions, not in local.
Environment summary SDK Version: Microsoft.Azure.Cosmos versions 3.14.0 and 3.15.0 OS Version: Windows 10 local development, Azure Functions v3
Additional context Work Around: Remove Partition Key in query.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:13 (3 by maintainers)
Top GitHub Comments
We recently encountered this issue using Microsoft.Azure.Cosmos 3.29.0: queries with Partition.None worked correctly on local development environment and failed when deployed in Azure with error: ‘PartitionKey has fewer components than defined the collection resource.’
Turns out the App Service we were running this code on had Platform = 32 Bit, while on local we were running on 64 Bit.
We solved the problem by setting the Azure App Service Platform to 64 Bit.
(The error also reproduced on the local development environment when debugging using x86 solution platform)
Will replicate and inform. Appreciated.