Upgrading gremlin breaks connection

2019-07-25 02:37发布

问题:

With gremlin javascript version 3.2.10 the following function connects to my Neptune cluster correctly:

export const initGremlinClient = () => {
  try {
    const dc = new DriverRemoteConnection(
      `ws://${process.env.NEPTUNE_ENDPOINT_URI}:${
        process.env.NEPTUNE_ENDPOINT_PORT
      }/gremlin`
    );
    const graph = new Graph();
    return {
      g: graph.traversal().withRemote(dc),
      closeGremlinConnection: () => dc.close()
    };
  } catch (error) {
    console.log("[GREMLIN INIT ERROR]", error);
    throw new Error(error);
  }
};

If I upgrade to version ^3.4.0 it throws the following error:

"Error: TypeError: Cannot read property 'reader' of undefined"

This is running in a Lambda function on NodeJS 8.10. The docs don't seem to indicate anything new in this version, nor does AWS specify a compatibility issue with Neptune. Do I have this misconfigured?

EDIT: Adding stack trace

{
  "errorMessage": "Cannot read property 'reader' of undefined",
  "errorType": "TypeError",
  "stackTrace": [
    "new Connection (/var/task/gremlinTest/node_modules/gremlin/lib/driver/connection.js:77:28)",
    "new Client (/var/task/gremlinTest/node_modules/gremlin/lib/driver/client.js:46:24)",
    "new DriverRemoteConnection (/var/task/gremlinTest/node_modules/gremlin/lib/driver/driver-remote-connection.js:53:20)",
    "exports.handler (/var/task/gremlinTest/index.js:6:14)"
  ]
}

回答1:

A patch was accepted for this recently and should land in 3.3.6 and 3.4.1 soon according to this issue report.