How to interact with Janusgraph using NodeJs

311 views
Skip to first unread message

mo...@fastfox.com

unread,
Oct 29, 2018, 5:32:31 AM10/29/18
to JanusGraph users
Hi,

I am new to Janusgraph and want to try how I can interact with it using Node Js. Do I need to configure my gremlin server to allow remote connections? I am not sure how exactly that is to be done. Please help.

I get the following error when I try to run my nodejs code

const gremlin = require('gremlin');
const Graph = gremlin.structure.Graph;
const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;
const graph = new Graph();
const g = graph.traversal().withRemote(new DriverRemoteConnection('ws://localhost:8182/gremlin'));
g
.V().has('lead', 'leadLeadId', '30087713').values('leadLeadId').toList().then(function(res){console.log(res)},function(err){console.log('Hi');console.log(err)});
Promise {
 
<pending>,
  domain
:
   
Domain {
     domain
: null,
     _events
: { error: [Function: debugDomainError] },
     _eventsCount
: 1,
     _maxListeners
: undefined,
     members
: [] } }
> Hi
Error: Server error: The traversal source [g] for alias [g] is not configured on the server. (499)
    at DriverRemoteConnection._handleMessage (/home/mohit/node_modules/gremlin/lib/driver/driver-remote-connection.js:180:9)
    at
WebSocket.DriverRemoteConnection._ws.on.data (/home/mohit/node_modules/gremlin/lib/driver/driver-remote-connection.js:72:41)
    at emitOne
(events.js:116:13)
    at
WebSocket.emit (events.js:211:7)
    at
Receiver._receiver.onmessage (/home/mohit/node_modules/gremlin/node_modules/ws/lib/WebSocket.js:141:47)
    at
Receiver.dataMessage (/home/mohit/node_modules/gremlin/node_modules/ws/lib/Receiver.js:380:14)
    at
Receiver.getData (/home/mohit/node_modules/gremlin/node_modules/ws/lib/Receiver.js:330:12)
    at
Receiver.startLoop (/home/mohit/node_modules/gremlin/node_modules/ws/lib/Receiver.js:165:16)
    at
Receiver.add (/home/mohit/node_modules/gremlin/node_modules/ws/lib/Receiver.js:139:10)
    at
Socket._ultron.on (/home/mohit/node_modules/gremlin/node_modules/ws/lib/WebSocket.js:138:22)



mo...@fastfox.com

unread,
Oct 29, 2018, 6:51:46 AM10/29/18
to JanusGraph users
Checked my gremlin-server log, there was a silly mistake in my configuration file due to which gremlin server was not getting started properly. Fixed it :)

Yamiteru XYZ

unread,
Jan 3, 2021, 5:56:02 PM1/3/21
to JanusGraph users
How did you fix it?
Reply all
Reply to author
Forward
0 new messages