neo4j / neo4j-browser

Neo4j Browser is the general purpose user interface for working with Neo4j. Query, visualize, administrate and monitor the database.
https://neo4j.com
GNU General Public License v3.0
695 stars 348 forks source link

WebSocket connection to 'ws://localhost:7687/' failed #522

Closed netpoe closed 7 years ago

netpoe commented 7 years ago

I installed neo4j with Docker and opened the browser window on localhost:7474

Here's my docker-compose.yml file:

neo4j:
  container_name: neo4j
  image: neo4j
  ports:
    - 7474:7474
    - 7867:7867
  volumes:
    - ~/Projects/Docker/neo4j/data:/data
    - ./conf/neo4j.conf:/conf/neo4j.conf
    - ~/Projects/Docker/neo4j/logs:/logs

I've added a neo4j.conf file with these settings:

#*****************************************************************
# Neo4j configuration
#
# For more details and a complete list of settings, please see
# https://neo4j.com/docs/operations-manual/current/reference/configuration-settings/
#*****************************************************************

# The name of the database to mount
#dbms.active_database=graph.db

# Paths of directories in the installation.
dbms.directories.data=/data
#dbms.directories.plugins=plugins
#dbms.directories.certificates=certificates
dbms.directories.logs=/logs
#dbms.directories.lib=lib
#dbms.directories.run=run

# This setting constrains all `LOAD CSV` import files to be under the `import` directory. Remove or comment it out to
# allow files to be loaded from anywhere in the filesystem; this introduces possible security problems. See the
# `LOAD CSV` section of the manual for details.
dbms.directories.import=import

# Whether requests to Neo4j are authenticated.
# To disable authentication, uncomment this line
dbms.security.auth_enabled=false

# Enable this to be able to upgrade a store from an older version.
#dbms.allow_format_migration=true

# Java Heap Size: by default the Java heap size is dynamically
# calculated based on available system resources.
# Uncomment these lines to set specific initial and maximum
# heap size.
dbms.memory.heap.initial_size=512M
dbms.memory.heap.max_size=512M

# The amount of memory to use for mapping the store files, in bytes (or
# kilobytes with the 'k' suffix, megabytes with 'm' and gigabytes with 'g').
# If Neo4j is running on a dedicated server, then it is generally recommended
# to leave about 2-4 gigabytes for the operating system, give the JVM enough
# heap to hold all your transaction state and query context, and then leave the
# rest for the page cache.
# The default page cache memory assumes the machine is dedicated to running
# Neo4j, and is heuristically set to 50% of RAM minus the max Java heap size.
dbms.memory.pagecache.size=512M

#*****************************************************************
# Network connector configuration
#*****************************************************************

# With default configuration Neo4j only accepts local connections.
# To accept non-local connections, uncomment this line:
# dbms.connectors.default_listen_address=0.0.0.0

# You can also choose a specific network interface, and configure a non-default
# port for each connector, by setting their individual listen_address.

# The address at which this server can be reached by its clients. This may be the server's IP address or DNS name, or
# it may be the address of a reverse proxy which sits in front of the server. This setting may be overridden for
# individual connectors below.
#dbms.connectors.default_advertised_address=localhost

# You can also choose a specific advertised hostname or IP address, and
# configure an advertised port for each connector, by setting their
# individual advertised_address.

# 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

# Number of Neo4j worker threads.
#dbms.threads.worker_count=

#*****************************************************************
# Logging configuration
#*****************************************************************

# To enable HTTP logging, uncomment this line
dbms.logs.http.enabled=true

# Number of HTTP logs to keep.
#dbms.logs.http.rotation.keep_number=5

# Size of each HTTP log that is kept.
#dbms.logs.http.rotation.size=20m

# To enable GC Logging, uncomment this line
#dbms.logs.gc.enabled=true

# GC Logging Options
# see http://docs.oracle.com/cd/E19957-01/819-0084-10/pt_tuningjava.html#wp57013 for more information.
#dbms.logs.gc.options=-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintPromotionFailure -XX:+PrintTenuringDistribution

# Number of GC logs to keep.
#dbms.logs.gc.rotation.keep_number=5

# Size of each GC log that is kept.
#dbms.logs.gc.rotation.size=20m

# Size threshold for rotation of the debug log. If set to zero then no rotation will occur. Accepts a binary suffix "k",
# "m" or "g".
#dbms.logs.debug.rotation.size=20m

# Maximum number of history files for the internal log.
#dbms.logs.debug.rotation.keep_number=7

#*****************************************************************
# Miscellaneous configuration
#*****************************************************************

# Enable this to specify a parser other than the default one.
#cypher.default_language_version=3.0

# Determines if Cypher will allow using file URLs when loading data using
# `LOAD CSV`. Setting this value to `false` will cause Neo4j to fail `LOAD CSV`
# clauses that load data from the file system.
#dbms.security.allow_csv_import_from_file_urls=true

# Retention policy for transaction logs needed to perform recovery and backups.
dbms.tx_log.rotation.retention_policy=1 days

# Enable a remote shell server which Neo4j Shell clients can log in to.
# dbms.shell.enabled=true
# The network interface IP the shell will listen on (use 0.0.0.0 for all interfaces).
# dbms.shell.host=127.0.0.1
# The port the shell will listen on, default is 1337.
# dbms.shell.port=1337

# Only allow read operations from this Neo4j instance. This mode still requires
# write access to the directory for lock purposes.
#dbms.read_only=false

# Comma separated list of JAX-RS packages containing JAX-RS resources, one
# package name for each mountpoint. The listed package names will be loaded
# under the mountpoints specified. Uncomment this line to mount the
# org.neo4j.examples.server.unmanaged.HelloWorldResource.java from
# neo4j-server-examples under /examples/unmanaged, resulting in a final URL of
# http://localhost:7474/examples/unmanaged/helloworld/{nodeId}
#dbms.unmanaged_extension_classes=org.neo4j.examples.server.unmanaged=/examples/unmanaged

#********************************************************************
# JVM Parameters
#********************************************************************

# G1GC generally strikes a good balance between throughput and tail
# latency, without too much tuning.
dbms.jvm.additional=-XX:+UseG1GC

# Have common exceptions keep producing stack traces, so they can be
# debugged regardless of how often logs are rotated.
dbms.jvm.additional=-XX:-OmitStackTraceInFastThrow

# Make sure that `initmemory` is not only allocated, but committed to
# the process, before starting the database. This reduces memory
# fragmentation, increasing the effectiveness of transparent huge
# pages. It also reduces the possibility of seeing performance drop
# due to heap-growing GC events, where a decrease in available page
# cache leads to an increase in mean IO response time.
# Try reducing the heap memory, if this flag degrades performance.
dbms.jvm.additional=-XX:+AlwaysPreTouch

# Trust that non-static final fields are really final.
# This allows more optimizations and improves overall performance.
# NOTE: Disable this if you use embedded mode, or have extensions or dependencies that may use reflection or
# serialization to change the value of final fields!
dbms.jvm.additional=-XX:+UnlockExperimentalVMOptions
dbms.jvm.additional=-XX:+TrustFinalNonStaticFields

# Disable explicit garbage collection, which is occasionally invoked by the JDK itself.
dbms.jvm.additional=-XX:+DisableExplicitGC

# Remote JMX monitoring, uncomment and adjust the following lines as needed. Absolute paths to jmx.access and
# jmx.password files are required.
# Also make sure to update the jmx.access and jmx.password files with appropriate permission roles and passwords,
# the shipped configuration contains only a read only role called 'monitor' with password 'Neo4j'.
# For more details, see: http://download.oracle.com/javase/8/docs/technotes/guides/management/agent.html
# On Unix based systems the jmx.password file needs to be owned by the user that will run the server,
# and have permissions set to 0600.
# For details on setting these file permissions on Windows see:
#     http://docs.oracle.com/javase/8/docs/technotes/guides/management/security-windows.html
#dbms.jvm.additional=-Dcom.sun.management.jmxremote.port=3637
#dbms.jvm.additional=-Dcom.sun.management.jmxremote.authenticate=true
#dbms.jvm.additional=-Dcom.sun.management.jmxremote.ssl=false
#dbms.jvm.additional=-Dcom.sun.management.jmxremote.password.file=/absolute/path/to/conf/jmx.password
#dbms.jvm.additional=-Dcom.sun.management.jmxremote.access.file=/absolute/path/to/conf/jmx.access

# Some systems cannot discover host name automatically, and need this line configured:
#dbms.jvm.additional=-Djava.rmi.server.hostname=$THE_NEO4J_SERVER_HOSTNAME

# Expand Diffie Hellman (DH) key size from default 1024 to 2048 for DH-RSA cipher suites used in server TLS handshakes.
# This is to protect the server from any potential passive eavesdropping.
dbms.jvm.additional=-Djdk.tls.ephemeralDHKeySize=2048

#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
#  using this configuration file has been installed as a service.
#  Please uninstall the service before modifying this section.  The
#  service can then be reinstalled.

# Name of the service
dbms.windows_service_name=neo4j

#********************************************************************
# Other Neo4j system properties
#********************************************************************
dbms.jvm.additional=-Dunsupported.dbms.udc.source=tarball
wrapper.java.additional=-Dneo4j.ext.udc.source=docker
ha.host.data=c1f465c9e9d1:6001
ha.host.coordination=c1f465c9e9d1:5001
dbms.tx_log.rotation.retention.policy=100M size
causal_clustering.transaction_listen_address=0.0.0.0:6000
causal_clustering.transaction_advertised_address=c1f465c9e9d1:6000
causal_clustering.raft_listen_address=0.0.0.0:7000
causal_clustering.raft_advertised_address=c1f465c9e9d1:7000
causal_clustering.discovery_listen_address=0.0.0.0:5000
causal_clustering.discovery_advertised_address=c1f465c9e9d1:5000

At last, these commands to be able to open the browser:

docker-compose up -d
docker ps -a

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                                NAMES
e21733eb4314        neo4j               "/docker-entrypoin..."   28 minutes ago      Up 28 minutes       7473/tcp, 0.0.0.0:7474->7474/tcp, 7687/tcp, 0.0.0.0:7867->7867/tcp   neo4j

However, when I open the browser and run server connect as it is suggested, with these settings:

I get this:

<span title="N/A: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. If you have enabled encryption, ensure your browser is configured to trust the certificate Neo4j is configured to use. WebSocket `readyState` is: 3" class="jNxLDp"><i suppressiconstyles="true" class="fa fa-exclamation-triangle"></i> N/A: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. If you have enabled encryption, ensure your browser is configured to trust the certificate Neo4j is configured to use. WebSocket `readyState` is: 3</span>

And the Chrome devTools console:

WebSocket connection to 'ws://localhost:7687/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED 

in file neo4j-web.min.js:18
oskarhane commented 7 years ago

Hi @netpoe and thanks for the report. As the error message says, it fails to connect because the connection is refused. What if you uncomment dbms.connectors.default_listen_address=0.0.0.0 in your config file, does that change anything? It's suggested here: https://github.com/neo4j/docker-neo4j/issues/31

If not I would suggest that you raise the question in our docker repo: https://github.com/neo4j/docker-neo4j because this does not seem to be a Neo4j Browser issue.

thobalose commented 7 years ago

Hi @oskarhane, @netpoe

I seem to be facing the same error but I have disabled bolt and https because I want to only expose http, my connectors look like:

dbms.connectors.default_listen_address=0.0.0.0
# individual connectors below.
#dbms.connectors.default_advertised_address=localhost
# HTTPS Connector. There can be zero or one HTTPS connectors.
# Network connector configuration
dbms.connectors.default_listen_address=0.0.0.0
# port for each connector, by setting their individual listen_address.
# individual connectors below.
#dbms.connectors.default_advertised_address=localhost
# configure an advertised port for each connector, by setting their
# Bolt connector
dbms.connector.bolt.enabled=false
#dbms.connector.bolt.tls_level=OPTIONAL
#dbms.connector.bolt.listen_address=: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=false
#dbms.connector.https.listen_address=:7473

I am using neo4j:3.2.1 and neo4j-browser:3.0.4. I do not see the Do not use Bolt option.

Thank you

fhureau commented 7 years ago

Hello, I have the same issue, but using bolt and https over a secure connection. Both are configured to listen to all ports, and here is what my console says :

neo4j_websocket_error

giovtorres commented 7 years ago

I'm having the same issue as well. I'm using neo4j-3.2.5 on CentOS 7 via the neo4j yum repo. The browser version is 3.0.8. I have CA signed certs in the certificates directory. Here is my config:

dbms.directories.certificates=/var/lib/neo4j/certificates
dbms.connector.bolt.enabled=true
dbms.connector.bolt.tls_level=REQUIRED
dbms.connector.bolt.listen_address=0.0.0.0:7687
dbms.connector.http.enabled=true
dbms.connector.https.enabled=true
dbms.connector.https.listen_address=0.0.0.0:7473

When I connect to https://neo4jserver:7473, the initial wss connection works and I am able to login with the default credentials. On the next screen, I am prompted to change the password and get the following error: 18: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.

The error points to the same line of code in neo4j-web.min.js as the picture from @fhureau:

                        var e = "ws";
                        if (n.encrypted === !0 || n.encrypted === f.ENCRYPTION_ON) {
                            if (n.trust && "TRUST_CUSTOM_CA_SIGNED_CERTIFICATES" !== n.trust)
                                return void (this._error = (0,
                                a.newError)("The browser version of this driver only supports one trust strategy, 'TRUST_CUSTOM_CA_SIGNED_CERTIFICATES'. " + n.trust + ' is not supported. Please either use TRUST_CUSTOM_CA_SIGNED_CERTIFICATES or disable encryption by setting `encrypted:"' + f.ENCRYPTION_OFF + '"` in the driver configuration.'));
                            e = "wss"
                        }
                        this._url = e + "://" + n.host + ":" + n.port,
                        this._ws = new WebSocket(this._url),

It appears the change password page is creating a new websocket, but the if statement condition fails, e = "wss" doesn't get set, and the new websocket is using ws:// causing the Firefox and Chrome to block it due to Mixed Content.

What neo4j setting is required to get either n.encrypted === !0 or n.encrypted === f.ENCRYPTION_ON to evaluate to True?

Thanks.

oskarhane commented 7 years ago

Thank you @giovtorres, that pointed me in the right direction. However, your issue is not the same as there original issue since that's not over https. I found a bug and have opened a PR for it: https://github.com/neo4j/neo4j-browser/pull/650

giovtorres commented 7 years ago

Thanks @oskarhane !

oskarhane commented 7 years ago

Closing this due to inactivity, feel free to open if the issue still exists.

@thobalose You need to enable bolt to use Neo4j Browser in Neo4j 3.2 or higher. @fhureau Your issue was fixed in #650 and will be out in the next release.

sfines commented 7 years ago

I have the same problem- though I'm launching using a docker container with the following arguments:

ENV NEO4J_auth=none
ENV NEO4J_dbms_connectors_default__listen__address="0.0.0.0"
ENV NEO4J_dbms_connector_http_listen__address="0.0.0.0:7474"
ENV NEO4J_dbms_connector_https_listen__address="0.0.0.0:7473"
ENV NEO4J_dbms_connector_bolt_listen__address="0.0.0.0:7687"

EXPOSE 7474 7473 7687

It's customized so that I can load test data in the container before starting a dependent process.

Fl0ble commented 6 years ago

I have the same problem. I want to run Neo4j in a Docker container running in an OpenShift environment. I make use of the lates Neo4j Docker image (3.3.0 CE).

In the neo4j.conf file I uncommented the lines dbms.connectors.default_listen_address=0.0.0.0 and dbms.connector.bolt.address=0.0.0.0:7687. However, I still get the error:

WebSocket connection to 'wss://neo4j.<remote_host>:7687/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

Is there another solution to this problem?

nemi83 commented 6 years ago

I also have the same problem with Neo4j desktop (3.3.0) running on Linux. I also changed the neo4j.conf file as it was recommended and I get the error: WebSocket connection to 'ws://localhost:7474/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

oskarhane commented 6 years ago

@Fl0ble and @sfines Is it a self signed certificate or a CA trusted one?

@nemi83 There's no websocket at port 7474, just http. the default bolt pot is 7687.

Fl0ble commented 6 years ago

@oskarhane In our case it is a Let's Encrypt certificate.

edziembowski commented 6 years ago

Hi @oskarhane,

I just upgraded neo4j from 3.0.5 to 3.3.1 and am now getting a similar issue when trying to connect using the browser. I've made the applicable changes to the config file and I'm seeing this in Chrome's dev tools: "neo4j-web.min.js:20 WebSocket connection to 'ws://localhost:7687/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED".

I've confirmed the port is open and listening, and my web application is still able to connect to the bolt port just fine since the upgrade, so this seems specific to the browser. I've seen a number of comments related to SSL, but should that be an issue if I'm accessing the browser over HTTP and connecting via the bolt port?

Any guidance you could provide would be much appreciated, thank you!!!

c4urself commented 6 years ago

I solved this by using the dbms.connector.bolt.advertised_address setting. This is how you change what the client (browser WS client) uses to connect to bolt. Example server1:7687

chirag912 commented 6 years ago

@oskarhane Im, having a very similar issue. This is my etc/neo4j/neo4j.conf data

*****

Neo4j configuration

#

For more details and a complete list of settings, please see

https://neo4j.com/docs/operations-manual/current/reference/configuration-settings/

*****

The name of the database to mount

dbms.active_database=graph.db

Paths of directories in the installation.

dbms.directories.data=/var/lib/neo4j/data dbms.directories.plugins=/var/lib/neo4j/plugins dbms.directories.certificates=/var/lib/neo4j/certificates dbms.directories.logs=/var/log/neo4j dbms.directories.lib=/usr/share/neo4j/lib dbms.directories.run=/var/run/neo4j dbms.directories.metrics=/var/lib/neo4j/metrics

This setting constrains all LOAD CSV import files to be under the import directory. Remove or comment it out to

allow files to be loaded from anywhere in the filesystem; this introduces possible security problems. See the

LOAD CSV section of the manual for details.

dbms.directories.import=/var/lib/neo4j/import

Whether requests to Neo4j are authenticated.

To disable authentication, uncomment this line

dbms.security.auth_enabled=false

Enable this to be able to upgrade a store from an older version.

dbms.allow_upgrade=true

Java Heap Size: by default the Java heap size is dynamically

calculated based on available system resources.

Uncomment these lines to set specific initial and maximum

heap size.

dbms.memory.heap.initial_size=512m

dbms.memory.heap.max_size=512m

screen shot 2018-03-29 at 3 06 50 am

This is the error that i get as soon as i click on connect.

Ok, the Neo4j is installed on a open stack server. And im creating a ssh channel like this

ssh -L :7474:127.0.0.1:7474 ubuntu@208.75.00.001 -v -v

from my mac os terminal.

the firewall on the remote server is off as well.

I have tried many things. Please any help here would be really appreciated.

oskarhane commented 6 years ago

@chirag912 You have two choices:

chirag912 commented 6 years ago

HI,

Thank you for the reply. I will try this and post back.

Thanks again

On Thu, Mar 29, 2018 at 11:50 AM, Oskar Hane notifications@github.com wrote:

@chirag912 https://github.com/chirag912 You have two choices:

  • You need to tunnel port 7687 as well or
  • Use the host/ip of the remote server instead of localhost as the bolt host. If you do this you need to set the servers listen address to 0.0.0.0 as well since you're connecting from the outside.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/neo4j/neo4j-browser/issues/522#issuecomment-377134045, or mute the thread https://github.com/notifications/unsubscribe-auth/AFTlKRSQv2QSf7QQJUqbVPt1yGk0wcuPks5tjH0pgaJpZM4NcgyS .

chirag912 commented 6 years ago

HI,

I checked and your idea to tunnel port 7867 with 7474 worked.!! So just of rite record i tunnel ported 7474 from one terminal window and opened another window for tunnel porting 7687.

However , would you recommend this as a permanent solution to access neo4j (on cloud) from my localhost. ?

Thank you , Ill really appreciate the help and support.

Thanks

On Tue, Apr 3, 2018 at 4:06 PM, chirag jhumkhawala chirag912@gmail.com wrote:

HI,

Thank you for the reply. I will try this and post back.

Thanks again

On Thu, Mar 29, 2018 at 11:50 AM, Oskar Hane notifications@github.com wrote:

@chirag912 https://github.com/chirag912 You have two choices:

  • You need to tunnel port 7687 as well or
  • Use the host/ip of the remote server instead of localhost as the bolt host. If you do this you need to set the servers listen address to 0.0.0.0 as well since you're connecting from the outside.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/neo4j/neo4j-browser/issues/522#issuecomment-377134045, or mute the thread https://github.com/notifications/unsubscribe-auth/AFTlKRSQv2QSf7QQJUqbVPt1yGk0wcuPks5tjH0pgaJpZM4NcgyS .

ghost commented 6 years ago

Hi, I did setup Neo4j casual cluster on GKE, and exposed using load balancer service. but when I try to connect from outside GKE(App Engine or local machine) I am getting always below error, but from inside cluster working perfectly fine. `Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/neo4j/addressing.py", line 108, in resolve info = getaddrinfo(socket_address[0], socket_address[1], 0, SOCK_STREAM, IPPROTO_TCP) File "/usr/local/lib/python3.6/socket.py", line 745, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/monsoon-reco/monsoon/models/merchant.py", line 63, in load merchant_id=self.merchant_id File "/usr/local/lib/python3.6/site-packages/neo4j/v1/api.py", line 500, in read_transaction return self._run_transaction(READ_ACCESS, unit_of_work, *args, kwargs) File "/usr/local/lib/python3.6/site-packages/neo4j/v1/api.py", line 467, in _run_transaction self._connect(access_mode) File "/usr/local/lib/python3.6/site-packages/neo4j/v1/api.py", line 260, in _connect self._connection = self._acquirer(access_mode) File "/usr/local/lib/python3.6/site-packages/neo4j/v1/routing.py", line 410, in acquire connection = self.acquire_direct(address) # should always be a resolved address File "/usr/local/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 450, in acquire_direct connection = self.connector(address, self.connection_error_handler) File "/usr/local/lib/python3.6/site-packages/neo4j/v1/routing.py", line 457, in connector return connect(address, security_plan.ssl_context, error_handler, config) File "/usr/local/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 691, in connect for resolved_address in resolve(address): File "/usr/local/lib/python3.6/site-packages/neo4j/addressing.py", line 110, in resolve raise AddressError("Cannot resolve address {!r}".format(socket_address[0])) neo4j.exceptions.AddressError: Cannot resolve address 'neo4j-readreplica-0.neo4j-read.default.svc.cluster.local'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function return cors_after_request(app.make_response(f(*args, kwargs))) File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](req.view_args) File "/monsoon-reco/monsoon/corejs/views.py", line 69, in corejs merchant = Merchant(merchant_id=merchant_id).load() File "/monsoon-reco/monsoon/models/merchant.py", line 63, in load merchant_id=self.merchant_id File "/usr/local/lib/python3.6/site-packages/neo4j/v1/api.py", line 251, in exit self.close() File "/usr/local/lib/python3.6/site-packages/neo4j/v1/api.py", line 282, in close self.rollback_transaction() File "/usr/local/lib/python3.6/site-packages/neo4j/v1/api.py", line 450, in rollback_transaction rollback_result = self.rollback() File "/usr/local/lib/python3.6/site-packages/neo4j/v1/api.py", line 537, in rollback return self.run(u"ROLLBACK", {}) File "/usr/local/lib/python3.6/site-packages/neo4j/v1/api.py", line 524, in run return self._run(statement, parameters) File "/usr/local/lib/python3.6/site-packages/neo4j/v1/api.py", line 513, in _run self._last_result = result = BoltStatementResult(self, run_response, pull_all_response) File "/usr/local/lib/python3.6/site-packages/neo4j/v1/result.py", line 44, in init super(BoltStatementResult, self).init(session, PackStreamHydrator(session._connection.protocol_version)) AttributeError: 'NoneType' object has no attribute 'protocol_version'`

sgm0107 commented 5 years ago

Hello everyone.. I am having the same issue. Any solution without having to create a SSH tunnel?

WebSocket connection to 'ws://localhost:7687/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

twall commented 5 years ago

I have an ssh tunnel for port 7687, and I can connect to bolt://localhost:7687 with the web browser, but when I try to connect via py2neo, the connection is terminated (regardless of the secure setting and proper auth settings):

E           neobolt.exceptions.ServiceUnavailable: Connection to ('127.0.0.1', 7687) closed without handshake response
twall commented 5 years ago

The problem I had was with py2neo itself; it has a bug where it fails to forward the secure setting over the bolt connection.

msramalho commented 4 years ago

I got this problem on Docker version of neo4j:4.0.0 and I had to dump the config file in a volume and then update the configuration from

dbms.connector.bolt.advertised_address=0.0.0.0:7687

to

dbms.connector.bolt.advertised_address=localhost:7687

and it started working.

Maltemo commented 4 years ago

In a docker-compose file, you can add this option like this :

neo4j:
  environment:
    NEO4J_dbms_connector_bolt_advertised__address: "localhost:7687"

I had this problem only in firefox on Windows10.

mjmare commented 4 years ago

@Maltemo thanks for the pointer! I think that your line is not completely correct. This worked for me:

neo4j:
    environment:
         - NEO4J_dbms_connector_bolt_advertised__address=myneohost.mydomain.nl:7687
jotamotk commented 3 years ago

I get the same issue when using JavaScript driver to connect NEO4J Sandbox. There is no way to modify configs for Sandbox, so it looks like a dead-end..

exaucae commented 3 years ago

adding to @Maltemo answer, sometimes, you just need to change the host address as is: neo4j://localhost:7687.