question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Expected Stream, got object

See original GitHub issue

Trying to connect to either a Janus database, Tinkergraph Database or OreintDB. In each case I have managed to connect a gremlin server to the database. I am able to connect to the gremlin server with the gremlin console and can traverse the records. However I am unable to do so with gremlin-javascript. If you could add some insight to what I am doing wrong it would be muchly appreciated. simple code I am using:

var gremlin = require('gremlin');
var client = gremlin.createClient();
console.log(client);
var script = 'g.V()';
// Callback style
client.execute(script, function(err, res) {
   console.log(err, res);
});

the error stack: (Including the console.log of the client):

client GremlinClient {
   domain: null,
   _events: {},
   _eventsCount: 0,
   _maxListeners: undefined,
   port: 8182,
   host: 'localhost',
   options:
    { language: 'gremlin-groovy',
      session: false,
      op: 'eval',
      processor: '',
      accept: 'application/json',
      executeHandler: [Function: defaultExecuteHandler],
      ssl: false,
      rejectUnauthorized: true,
      user: '',
      password: '',
      path: '/gremlin' },
   useSession: false,
   user: '',
   password: '',
   connected: false,
   queue: [],
   commands: {},
   connection:
    WebSocketGremlinConnection {
      domain: null,
      _events:
       { open: [Function],
         error: [Function],
         message: [Function],
         close: [Function] },
      _eventsCount: 4,
      _maxListeners: undefined,
      open: false,
      ws:
       WebSocket {
         domain: null,
         _events: [Object],
         _eventsCount: 4,
         _maxListeners: undefined,
         readyState: 0,
         bytesReceived: 0,
         extensions: {},
         protocol: '',
         _binaryType: 'arraybuffer',
         _finalize: [Function: bound finalize],
         _finalizeCalled: false,
         _closeMessage: null,
         _closeTimer: null,
         _closeCode: null,
         _receiver: null,
         _sender: null,
         _socket: null,
         _ultron: null,
         protocolVersion: 13,
         _isServer: false,
         url: 'ws://localhost:8182/gremlin',
         _req: [Object] } } }
events.js:182
       throw er; // Unhandled 'error' event
       ^

Error: Expected Stream, got object
     at
/home/farqs/Code/testClient/node_modules/highland/lib/index.js:3504:26
     at
/home/farqs/Code/testClient/node_modules/highland/lib/index.js:1576:9
     at Stream.s._send
(/home/farqs/Code/testClient/node_modules/highland/lib/index.js:1532:9)
     at Stream.write
(/home/farqs/Code/testClient/node_modules/highland/lib/index.js:1633:18)
     at Stream._send
(/home/farqs/Code/testClient/node_modules/highland/lib/index.js:959:26)
     at push
(/home/farqs/Code/testClient/node_modules/highland/lib/index.js:1498:19)
     at
/home/farqs/Code/testClient/node_modules/highland/lib/index.js:2104:13
     at Stream.s._send
(/home/farqs/Code/testClient/node_modules/highland/lib/index.js:1532:9)
     at Stream.write
(/home/farqs/Code/testClient/node_modules/highland/lib/index.js:1633:18)
     at Stream._send
(/home/farqs/Code/testClient/node_modules/highland/lib/index.js:959:26)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dwelch2344commented, Dec 26, 2017

Just a heads up, seeing this with AWS’ new Neptune service that is still in beta. The data I’m getting back is definitely the “g:List” type on the right hand side of @Tomen’s diff. Still new to the Gremlin space, but it sounds like this is related to Serialization, right?

1reaction
Tomencommented, Dec 18, 2017

It has something to do with the version of Tinkerpop Gremlin Server. I just tried Tinkerpop Gremlin Server 3.2.6 and it worked!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Error TypeError: You provided an invalid object where ...
Error TypeError: You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable. at ...
Read more >
Top 10 Most Common Node.js Developer Mistakes - Toptal
The Top 10 Most Common Mistakes That Node.js Developers Make ; // Trying to fetch an user object from the database. Node.js is...
Read more >
"Expected Ref and got Object" when attempting to start stream ...
I'm attempting to setup streaming on an application and running into an error, here's my code sample:
Read more >
A Comprehensive Guide To Error Handling In Node.js
An error in Node.js is any instance of the Error object. ... 'number') { throw new TypeError(`Expected number but got: ${typeof num}`); ...
Read more >
Stream | Node.js v19.3.0 Documentation
ServerResponse, which is a writable stream. let body = ''; // Get the data as utf8 strings. // If an encoding is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found