Azure / azure-webjobs-sdk-extensions

Azure WebJobs SDK Extensions
MIT License
342 stars 205 forks source link

The given key was not present in the dictionary (CosmosDB SQL) #624

Closed theav8or closed 3 years ago

theav8or commented 4 years ago

Possible bug in Java CosmosDB (SQL) client, when using NULL values in Java function. Troubleshooting: Tried to reset the DB LVL (keeps track of the level in the subtree ) – fails UDF (User def’ Query)- works but will use up the AU on DB.

Error can be Reproduce using HTTP trigger - https://.azurewebsites.net/api/IsDocSeenBefore Querying CosmosDB for the same table with NULL onJS completed with-out error Currently AzF Java version is 1.3.0 (see POM.XML), would switching to 1.3.1 include code updated to the ComsosDB client?

Investigative information

Please provide the following:

Repro steps

Provide the steps required to reproduce the problem:

amamounelsayed commented 4 years ago

cc @fabiocav @brettsam, I tested this behavior with java and node.

amamounelsayed commented 4 years ago

The issue when call the function, Example @HttpTrigger(name = "req", methods = {HttpMethod.GET, HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional> request, @CosmosDBInput(name = "dbClient", databaseName ="SOME_DATABASE", collectionName = "SOME_TABLE", connectionStringSetting = "AzureWebJobsCosmosDBConnectionString", sqlQuery = PERSON_QUERY) String[] items, PERSON_QUERY = "select * from Person where '1' == {data}"

The Post request body: { "data": "" vs "data": null }

swau10tix commented 4 years ago

HI there, The impact of not being able to send null values from fn app to cosmos is :

  1. We have to do a work around that includes a lot of conditioning in the SQL
  2. It has some performance impact on the query execution

please let us know if/when this can be fixed on the fn app level.

v-anvari commented 3 years ago

Hi @ealsur , Can you please look into this request, the bugs must probably be fixed already. Can you please share your inputs

ealsur commented 3 years ago

@v-anvari I don't know if this is related to Java or not, but I don't see what is the actual error stack trace? Without that, it's hard to know what is the origin. I get that the customer is using CosmosDB bindings, but I don't see if the error is actually related to any code path in the particular extension or it is part of the .NET > Java translation layer.

v-anvari commented 3 years ago

Thank you Mathias,

@theav8or are you still facing this error, is yes can you provide the latest error details, that is the latest invocation id of the error and the region.

ghost commented 3 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.