graph-explorer icon indicating copy to clipboard operation
graph-explorer copied to clipboard

[Bug] Unable to create a connection successfully if a graph databases contains only vertices and no edges

Open joywa opened this issue 2 years ago • 1 comments

Community Note

  • Please use a 👍 reaction to provide a +1/vote. This helps the community and maintainers prioritize this request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Describe the bug

Tested this with Neptune db. I created vertices on the db with no edges in gremlin format. Then trying to create connection from graph-explorer, the connection was not successful. Misleading error gives as unable to connect with database but while debugging the backend error is:

{
code: 'MalformedQueryException',
detailedMessage: "Failed to interpret Gremlin query: Query parsing failed at line 1, character position at 14, error message : no viable alternative at input 'g.E().project()'",
requestId: '3b949d91-2969-4602-9aee-ec1d6e363eed'
}

Expected behavior There should be a clear error from the UI as to what is happening. Also this should not fail a connection as nodes can still be displayed without edges on Graph Explorer.

Currently errors like above are not logged visibly in the proxy code. Hence needs debugging to find the actual errors. I would recommend checking the response code and log the errors on the console.

joywa avatar Apr 17 '23 23:04 joywa

Just a comment that g.E().project() is not valid Gremlin either. The Graph Explorer code should check the edge count and if it is zero not try to enumerate the edges. We also need to look at why invalid Gremlin is being generated by the Explorer in this case. It's quite possible that the lack of edges not being caught is the root cause.

krlawrence avatar Apr 18 '23 02:04 krlawrence

I attempted to reproduce this issue, but could not.

I also looked at the code and it seems like there are protections against this happening.

https://github.com/aws/graph-explorer/blob/c8bb106ffae6c75893f02520f3cd4cce87ab2349/packages/graph-explorer/src/connector/gremlin/queries/fetchSchema.ts#L183-L185

This must've been an issue from long enough ago where there sync process could somehow reach this state. But from what I can see, this bug has been fixed.

kmcginnes avatar Jul 08 '24 21:07 kmcginnes