简体   繁体   English

在 Node js 应用程序中集成 Neo4j(Heroku)时面临未知的 Bolt 协议版本

[英]Facing Unknown Bolt protocol version while integrationg Neo4j(Heroku) in Node js Application

I am a beginner in Neo4j I have tried using the code as suggested in this documentation: https://neo4j.com/developer/javascript/我是 Neo4j 的初学者 我已经尝试使用本文档中建议的代码: https://neo4j.com/developer/javascript/

But I am getting the following error:但我收到以下错误:

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)

Here is my code:这是我的代码:

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");
}

The error indicates that the bolt protocol might not be supported.该错误表明可能不支持螺栓协议。 Are you using the Neo4j version 3.5.x.您使用的是 Neo4j 版本 3.5.x。 I think that the new bolt+s protocol is enabled with the Neo4j 4.x series.我认为 Neo4j 4.x 系列启用了新的 bolt+s 协议。

Try changing the uri to:尝试将uri更改为:

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

Ran into the same issue running Neo4j on Heroku using GrapheneDB and I actually had to downgrade neo4j-driver from 4.1.0 to 4.0.2 and use the bolt v1 protocol bolt:// as @Tomaž Bratanič mentioned.使用 GrapheneDB 在 Heroku 上运行 Neo4j 时遇到了同样的问题,我实际上不得不将neo4j-driver4.1.0降级到4.0.2并使用bolt v1 协议bolt:// ,正如 @Tomaž Bratanič 提到的。

GrapheneDB's documentation says they don't currently (June 15, 2020) support the 4.1.0 driver just yet. GrapheneDB 的文档说他们目前(2020 年 6 月 15 日)还不支持4.1.0驱动程序。

You can also find more information on using the correct bolt versions here https://github.com/neo4j/neo4j-javascript-driver/issues/595 .您还可以在此处找到有关使用正确bolt版本的更多信息https://github.com/neo4j/neo4j-javascript-driver/issues/595

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM