julianbrowne / graffeine

D3 console for Neo4J
90 stars 19 forks source link

Getting error at the time to connect with neo4j server through graffeine #4

Closed Pallavim54 closed 9 years ago

Pallavim54 commented 9 years ago

I m running graffeine from npm:

npm install graffeine cd node_modules/graffeine npm start

When i m hitting npm start then getting below error

GitHub\node_modules\graffeine>npm start

graffeine@0.0.4 start GitHub\node_modules\graffeine node server.js

23 Jul 17:35:09 - --- INFO : Connecting to http://localhost:7474 23 Jul 17:35:09 - --- INFO : Starting Graffeine server 23 Jul 17:35:09 - --- INFO : Open browser to http://127.0.0.1:8004 23 Jul 17:35:09 - --- INFO : Starting WS server on 8004 23 Jul 17:35:25 - --- INFO : Got connection 23 Jul 17:35:48 - --- INFO : Got connection 23 Jul 17:35:48 - --- INFO : RECV: graph-stats -> : {} 23 Jul 17:35:48 - +++ DEBUG : (runQuery) : begin 23 Jul 17:35:48 - +++ DEBUG : START n=node() RETURN count(n) 23 Jul 17:35:48 - +++ DEBUG : (runQuery) : end 23 Jul 17:35:48 - +++ DEBUG : (runQuery) : expecting aggregate result 23 Jul 17:35:48 - +++ DEBUG : (runQuery) : begin 23 Jul 17:35:48 - +++ DEBUG : START r=rel() RETURN count(r) 23 Jul 17:35:48 - +++ DEBUG : (runQuery) : end 23 Jul 17:35:48 - +++ DEBUG : (runQuery) : expecting aggregate result 23 Jul 17:35:48 - * ERROR : '{ [Error: Unknown Neo4j error (status 401).]\n stack: [Getter/Setter],\n message: \'Unknown Neo4j error (status 401).\',\n frame: \n { name: \'GraphDatabase_proto type_getServices2\',\n line: 99,\n file: \'C:\Users\\Documents\GitHub\node_modules\graffeine\node_modules\neo4j\lib\GraphDatabase.js\',\n prev: \n { name: \'GraphDatabase_prototype_query__20\',\n line: 710,\n file: \'C:\Users\Documents\GitHub\node_modules\graffeine\node_modules\neo4j\lib\ \GraphDatabase.js\',\n prev: undefined,\n active: false,\n offset: 2,\n col: 23 },\n active: false,\n offset: 5,\n col: 12 },\n rawStack: [Getter] }' 23 Jul 17:35:48 - * ERROR : '{ [Error: Unknown Neo4j error (status 401).]\n stack: [Getter/Setter],\n message: \'Unknown Neo4j error (status 401).\',\n frame: \n { name: \'GraphDatabase_proto type_getServices2\',\n line: 99,\n file: \'C:\Users\Documents\GitHub\node_modules\graffeine\node_modules\neo4j\lib\GraphDatabase.js\',\n prev: \n { name: \'GraphDatabase_prototype_query__20\',\n line: 710,\n file: \'C:\Users\Documents\GitHub\node_modules\graffeine\node_modules\neo4j\lib\ \GraphDatabase.js\',\n prev: undefined,\n active: false,\n offset: 2,\n col: 23 },\n active: false,\n offset: 5,\n col: 12 },\n rawStack: [Getter] }'

julianbrowne commented 9 years ago

Interesting. I've not seen that error before. It looks like the underlying node-neo4j package is returning that 401, which I would hazard a guess is indicating that the neo4j server is expecting a username and password. Graffeine by default doesn't send any credentials to neo4j.

Easy way to prove this is to run a simple query from the command line directly to the server, bypassing graffeine and node.js, like this:

curl -X post -H Accept:application/json -H Content-Type:application/json -d '{"query": "match n return n", "param": {} }' -v http://localhost:7474/db/data/cypher

If you get lots of JSON back then the connection is fine. If you get HTTP/1.1 401 then it's a security/credentials issue. Graffeine doesn't have explicit support for credentials yet (I will add that to the next release now that you've prompted it - thanks) but as the neo4j REST api takes a regular HTTP connection string you can enable this by editing conf/neo4j.json and changing "host":"localhost" to "host":"{username}:{password}@localhost" where {username} and {password} are the required credentials for accessing the server. Note though that they are stored in plain text and will be logged in the Graffeine output so obviously don't use a password that's used for anything sensitive etc.

update: I can replicate the exact error by configuring the neo4j authentication plugin and then trying to connect without credentials. If I then add a user/password and connect via Graffeine using the method described above it seems to work fine. Let me know how you get on and then I'll close this issue as fixed by the workaround of updating the connection string and also add a better way for the next release in a week or so. Thanks.

Pallavim54 commented 9 years ago

Thanks I am able to start Graffeine .