升级到AnonymousTraversalSource(gremlin3.3.5+;Node.js)
我正在用Lamda Nodejs12.x编写代码 我想更新到不推荐的连接方式升级到AnonymousTraversalSource(gremlin3.3.5+;Node.js),node.js,lambda,gremlin,Node.js,Lambda,Gremlin,我正在用Lamda Nodejs12.x编写代码 我想更新到不推荐的连接方式 const gremlin = require('gremlin'); const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection; const traversal = gremlin.process.AnonymousTraversalSource.traversal; const clusterEndpoint = process.en
const gremlin = require('gremlin');
const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;
const traversal = gremlin.process.AnonymousTraversalSource.traversal;
const clusterEndpoint = process.env.CLUSTER_ENDPOINT;
const port = process.env.CLUSTER_PORT;
const connectionStrArray = [];
connectionStrArray.push("wss://");
connectionStrArray.push(clusterEndpoint);
connectionStrArray.push(":");
connectionStrArray.push(port.toString());
connectionStrArray.push("/gremlin");
let joinedConnection = connectionStrArray.join("")
console.log(joinedConnection)
let dc = new DriverRemoteConnection(joinedConnection);
const g = traversal().withRemote(dc)
然后一些等待g.V().hasLabel
或类似产品
但我得到的只是:
无法读取未定义的属性“processor”
它与图(3.3.4)的旧方法一样工作良好
我做错了什么?
我错过了什么
更新
显然我需要添加travelsource
{traversalSource:'g'}
我找不到任何添加此内容的文档,仅对其进行了少量引用
更新2
对于懒惰的人:这是我得到的代码
const gremlin = require('gremlin');
const traversal = gremlin.process.AnonymousTraversalSource.traversal;
const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;
const clusterEndpoint = process.env.CLUSTER_ENDPOINT;
const port = process.env.CLUSTER_PORT;
const connectionStrArray = [];
connectionStrArray.push("wss://");
connectionStrArray.push(clusterEndpoint);
connectionStrArray.push(":");
connectionStrArray.push(port.toString());
connectionStrArray.push("/gremlin");
const g = traversal().withRemote(new DriverRemoteConnection(connectionStrArray.join(""), { traversalSource: 'g' }));
同样的错误也发生在我身上:
TypeError: Cannot read property 'processor' of undefined
不需要traversalSource,具体解决方案是将空对象传递给DriverRemoteConnection的第二个参数:
const g = traversal().withRemote(new DriverRemoteConnection(process.env.DATABASE_URL_LOCAL, {}));
因此,问题似乎是gremlin客户端中缺少的内部空检查
当我更新gremlin服务器时,这种情况开始发生,我没有更改客户端上的任何内容,奇怪…你认为有办法与开发人员或其他人核实一下吗?他们似乎有一个Jira,但只适用于“真正的bug报告”。现在我只想知道它是否是一个bug:D
const g = traversal().withRemote(new DriverRemoteConnection(process.env.DATABASE_URL_LOCAL, {}));