Exception: cross partition query can not be direct

2019-08-17 08:08发布

问题:

I get the following exception while making a query to Azure Cosmos DB. I am unable to understand the exact problem with this exception. It used to work earlier and I am sure that no recent changes were made to azure cosmos DB. Can anyone suggest how to proceed forward in fixing this exception.

DocumentClientException: The provided by the gateway. This is a first chance (internal) exception that all newer clients will know how to handle gracefully. This exception is traced, but unless you see it bubble up as an exception (which only happens on older SDK clients), then you can safely ignore this message.

回答1:

The 1.4.1 version is a really old SDK. The SDKs populate the version header so that the server would know which version should handle this request but it seems like in this case something has changed on the server side.

Upgrading to latest SDK version will fix the issue (as discussed in the comments).