Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream dependency Gremlin.Net version bump broke CosmosDb #49

Open
veeg opened this issue Mar 28, 2019 · 2 comments
Open

Upstream dependency Gremlin.Net version bump broke CosmosDb #49

veeg opened this issue Mar 28, 2019 · 2 comments

Comments

@veeg
Copy link
Contributor

veeg commented Mar 28, 2019

Hello.

In PR #44, the upstream dependency of Gremlin.Net was updated from 3.4.0-rc2 to 3.4.0.
This release includes TINKERPOP-3067 which changes the returned object from SubmitAsync when the requested return type is JToken. This means that the returned value in not fed through the following GraphSON reader method: https://github.com/apache/tinkerpop/blob/e238880f87bf8366310fdf006d2869c86a2957af/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs#L102-L117

CosmosDb will issue such a request:

public async Task<GraphResult> QueryAsync(string gremlinQuery)
{
if (gremlinQuery == null)
throw new ArgumentNullException(nameof(gremlinQuery));
var resultSet = await _gremlinClient.SubmitAsync<JToken>(gremlinQuery);
return new GraphResult(resultSet);
}

This in turn entails that the return value is not handled properly in CosmosDb,
exemplified by the following exception on the sample program:

Unhandled Exception: Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path ''.
   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
   at Gremlin.Net.CosmosDb.Serialization.IEdgeJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in /home/veeg/workspace/Gremlin.Net.CosmosDb/src/Gremlin.Net.CosmosDb/Serialization/IEdgeJsonConverter.cs:line 48
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
   at Newtonsoft.Json.Linq.JToken.ToObject[T](JsonSerializer jsonSerializer)
   at Gremlin.Net.CosmosDb.Structure.GraphResult`1.<>c__DisplayClass3_0.<.ctor>b__0(JToken token) in /home/veeg/workspace/Gremlin.Net.CosmosDb/src/Gremlin.Net.CosmosDb/Structure/GraphResult.cs:line 91
   at System.Linq.Enumerable.SelectEnumerableIterator`2.ToList()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Gremlin.Net.CosmosDb.Structure.GraphResult`1..ctor(ResultSet`1 resultSet, JsonSerializer serializer) in /home/veeg/workspace/Gremlin.Net.CosmosDb/src/Gremlin.Net.CosmosDb/Structure/GraphResult.cs:line 91
   at Gremlin.Net.CosmosDb.Structure.GraphResult.ApplyType[T](JsonSerializer serializer) in /home/veeg/workspace/Gremlin.Net.CosmosDb/src/Gremlin.Net.CosmosDb/Structure/GraphResult.cs:line 63
   at Gremlin.Net.CosmosDb.IGraphClientExensions.QueryAsync[T](IGraphClient graphClient, String gremlinQuery, JsonSerializerSettings serializerSettings) in /home/veeg/workspace/Gremlin.Net.CosmosDb/src/Gremlin.Net.CosmosDb/IGraphClient.Extensions.cs:line 153
   at GremlinSample.Program.Main() in /home/veeg/workspace/Gremlin.Net.CosmosDb/GremlinSample/Program.cs:line 42
   at GremlinSample.Program.<Main>()

To summarize what has changed: The JSON returned is now wrapped in an Array, not an Object. This crashes the program.

veeg pushed a commit to veeg/Gremlin.Net.CosmosDb that referenced this issue Mar 28, 2019
This is a temporary fix to issue evo-terren#49.
The proper fix is of course fixing the return value.
SamHard pushed a commit to SamHard/Gremlin.Net.CosmosDb that referenced this issue Jul 2, 2019
@SamHard
Copy link

SamHard commented Jul 3, 2019

This is a major defect -- the library source in the master branch is currently not usable.

I've created an issue for Gremlin.Net here: https://issues.apache.org/jira/browse/TINKERPOP-2253

@ankitbko
Copy link

I am also facing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants