【问题标题】:Facing Unknown Bolt protocol version while integrationg Neo4j(Heroku) in Node js Application在 Node js 应用程序中集成 Neo4j(Heroku)时面临未知的 Bolt 协议版本
【发布时间】:2020-06-29 20:07:38
【问题描述】:

我是 Neo4j 的初学者,我尝试使用本文档中建议的代码: https://neo4j.com/developer/javascript/

但我收到以下错误:

Neo4jError: Unknown Bolt protocol version: 0

at captureStacktrace (C:\Users\abdsheikh\Documents\NodeJSApps\DrugRepo\node_modules\neo4j-driver\lib\result.js:275:15)
at new Result (C:\Users\abdsheikh\Documents\NodeJSApps\DrugRepo\node_modules\neo4j-driver\lib\result.js:66:19)
at Session._run (C:\Users\abdsheikh\Documents\NodeJSApps\DrugRepo\node_modules\neo4j-driver\lib\session.js:172:14)
at Session.run (C:\Users\abdsheikh\Documents\NodeJSApps\DrugRepo\node_modules\neo4j-driver\lib\session.js:133:19)
at Object.<anonymous> (C:\Users\abdsheikh\Documents\NodeJSApps\DrugRepo\neo4j.js:12:33)

这是我的代码:

const neo4j = require('neo4j-driver')

uri = "bolt+s://<some-secret-url>.dbs.graphenedb.com:24787";
user = ""; //user was here
password = ""; // password was here

const driver = neo4j.driver(uri, neo4j.auth.basic(user, password))
const session = driver.session()

try {
  const resultPromise = session.run('match(c:Conditions) return c.Name');

  resultPromise.then(result => {
    session.close();
     console.log(node.properties);

    driver.close();
  }).catch((error) => {
    console.log(error);
  });

} finally {
  console.log("Bye");
}

【问题讨论】:

    标签: node.js heroku neo4j bolt graphenedb


    【解决方案1】:

    该错误表明可能不支持螺栓协议。您使用的是 Neo4j 版本 3.5.x。我认为 Neo4j 4.x 系列启用了新的 bolt+s 协议。

    尝试将 uri 更改为:

    uri = "bolt://<some-secret-url>.dbs.graphenedb.com:24787";
    

    【讨论】:

      【解决方案2】:

      使用 GrapheneDB 在 Heroku 上运行 Neo4j 时遇到了同样的问题,我实际上不得不将 neo4j-driver4.1.0 降级到 4.0.2 并使用 bolt v1 协议 bolt://,正如 @Tomaž Bratanič 提到的那样。

      GrapheneDB 的 documentation 表示他们目前(2020 年 6 月 15 日)还不支持 4.1.0 驱动程序。

      您还可以在此处https://github.com/neo4j/neo4j-javascript-driver/issues/595 找到有关使用正确bolt 版本的更多信息。

      【讨论】:

        猜你喜欢
        • 2019-11-16
        • 2018-01-27
        • 2021-09-30
        • 1970-01-01
        • 1970-01-01
        • 2014-07-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多