bricaud / graphexp

Interactive visualization of the Gremlin graph database with D3.js
Apache License 2.0
785 stars 217 forks source link

MalformedQueryException when working with Amazon Neptune #40

Closed carlosafonso closed 6 years ago

carlosafonso commented 6 years ago

Hi,

I might be doing something wrong, but I am unable to make Graphexp work with Amazon Neptune databases.

I'm running the latest Graphexp commit (0f3bf61), locally. Since Neptune DBs are not publicly accessible, I'm connecting to the DB through an SSH tunnel via a bastion host in AWS. This also avoids CORS-related issues. I can confirm that the DB is reachable.

However, clicking Get graph info or doing a search with the default values returns a MalformedQueryException:

{
   "requestId":"92b1f796-f0da-cc55-d363-03f03ba7ea57",
   "code":"MalformedQueryException",
   "detailedMessage":"Query parsing failed at line 1, character position at 2, error message : token recognition error at: 'des'"
}

This happens both with the Websockets and REST endpoints. And I can reproduce this error invoking the same call using Postman.

This is the request payload for Get graph info:

{
   "gremlin":"nodes = g.V().groupCount().by(label);nodesprop = g.V().valueMap().select(keys).groupCount();edges = g.E().groupCount().by(label);edgesprop = g.E().valueMap().select(keys).groupCount();[nodes.toList(),nodesprop.toList(),edges.toList(),edgesprop.toList()]"
}

If I simplify the query a bit the error still occurs:

{
   "gremlin":"nodes = g.V().groupCount().by(label);"
}

But if I remove the variable declaration, the query returns fine:

{
   "gremlin":"g.V().groupCount().by(label);"
}

Funnily enough, I see that the Neptune docs mention this:

Variables

Neptune does not support Gremlin variables and does not support the bindings property.

I have seen other commits fixing stuff related to Neptune, so if this is indeed the cause, my question is: how have other users managed to successfully connect to a Neptune DB? Shouldn't they be coming across the same issue?

Thank you and keep up the good work!

carlosafonso commented 6 years ago

My apologies, after looking this up I realized I hadn't properly set the SINGLE_COMMANDS_AND_NO_VARS option. Please feel free to close this issue.

bricaud commented 6 years ago

:) No problem. If you have time, you can add in the code some lines catching this error and displaying something like "did you set SINGLE_COMMANDS_AND_NO_VARS = true ?" in the '#outputArea', in the file graphioGremlin.js. And make a PR.

carlosafonso commented 6 years ago

Submitted #41 .

chb0github commented 6 years ago

I was having the same issue and set the flag as stated above. It wasn't until I set host to something that it started to work...