0

I have helped to create a web app that uses sigma.js to display a graphical output, on top of a neo4j database.

I am trying to use the neo4j-driver with this to enable me to set this web app up on a remote server, with its own version of neo4j community edition constantly running.

The issue at the moment is that whenever you run the web app through remote connection to the server, it only links to neo4j if you are running the on your local machine.

I was told to download the above driver and use bolt protocol to fix this however I cannot get this to work.

I am not the most experience coder however I have tried using require('neo4j-driver') to no avail and I have also tried just linking it to 'bolt://localhost:7867.

Any pointers will be greatly appreciated.

var url_ = 'bolt://localhost:7687' 
var pword = 'neo4j2' 
sigma.neo4j.getLabels(
        { url: url_, user: 'neo4j', password: pword },
        function (labels) {
            console.log(labels)
            NodeLabels = labels;
            console.log("NodeLabels: " + NodeLabels);
        }
); 

Thank you!

  • Have you enabled remote connections to the server: https://neo4j.com/developer/kb/how-do-i-enable-remote-https-access-with-neo4j-30x/ – Himanshu Jain Oct 05 '18 at 21:51
  • forgot to mention instead of http connector, you have to change bolt config similarly: dbms.connector.bolt.listen_address – Himanshu Jain Oct 05 '18 at 21:53

1 Answers1

0

Chances are you have not enabled remote connections on the Neo4j server. Depending upon what connector you want to change, you will have to uncomment, change that configuration. Refer to official neo4j connector config: Connector Config

Example config change:

# Bolt connector
dbms.connector.bolt.enabled=true
#dbms.connector.bolt.tls_level=OPTIONAL
dbms.connector.bolt.listen_address=0.0.0.0:7687

# HTTP Connector. There must be exactly one HTTP connector.
dbms.connector.http.enabled=true
dbms.connector.http.listen_address=0.0.0.0:7474

# HTTPS Connector. There can be zero or one HTTPS connectors.
dbms.connector.https.enabled=true
dbms.connector.https.listen_address=0.0.0.0:7473
Himanshu Jain
  • 1,809
  • 1
  • 13
  • 23
  • Hi, thank you for the reply, sorry for my lateness in replying back to you. I have done the changes you recommend however I get the following error in the browser console: 'Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.' – James Timmins Oct 11 '18 at 13:42
  • full error: sigma.parsers.cypher.js:68 Failed to load bolt://0.0.0.0:7687/db/data/transaction/commit: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. – James Timmins Oct 11 '18 at 14:03
  • I have updated my question above with some of the code, I have tried it with port 7687 and 7867. – James Timmins Oct 18 '18 at 13:36
  • @JamesTimmins can you try changing the url to http://localhost:7474 Also, I thought you were running neo4j on another machine. But any case, instead of bolt try using http and check if that works – Himanshu Jain Oct 18 '18 at 16:23
  • Hi Himanshu, we have tried that. The issue is we are accessing our app via internet browser as its on a remote server. If you use http it then looks for server on your local machine and not the one running on the remote server that it is running on. – James Timmins Oct 19 '18 at 10:45
  • shouldn't be the case. Why will it look for that on the local machine when you have provided the ip of the remote machine while making the rest calls. – Himanshu Jain Oct 19 '18 at 18:06
  • Yes, when you use the ip it doesn't work full stop. When you use local host it looks on your local machine. I know this because it works when I have a local instance of neo4j running and it doesn't work when I don't. – James Timmins Oct 23 '18 at 09:32
  • Sorry i haven't been able to help. did you change this line too in config: dbms.connectors.default_listen_address=0.0.0.0 – Himanshu Jain Oct 24 '18 at 01:41
  • No worries, thank you for trying. And yes I did change that line. – James Timmins Oct 25 '18 at 13:44