# Neo4j-Python connection problem: Neo4j on GCP

**URL:** <https://community.neo4j.com/t/neo4j-python-connection-problem-neo4j-on-gcp/66490>\
**Category:** Drivers & Stacks\
**Tags:** gcp, neo4j-python-driver\
**Created:** [February 23, 2024, 4:11pm UTC](https://community.neo4j.com/t/neo4j-python-connection-problem-neo4j-on-gcp/66490 "2024-02-23T16:11:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![manos](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/manos/32/30934_2.png) [@manos](https://community.neo4j.com/u/manos)\
**Post date:** [February 23, 2024, 4:11pm UTC](https://community.neo4j.com/t/neo4j-python-connection-problem-neo4j-on-gcp/66490/1 "2024-02-23T16:11:41Z")

</div>

Hello, I 've been trying to deploy a Neo4J database on Google Cloud but I ‘ve been facing connection problems.

I am using the _neo4j:5.15.0-enterprise_ Docker image and I am only interested in exposing the database port (no browser).

Locally everything works fine. On Google Cloud, the idea is to deploy it using **Cloud Run** (right now we don’t care about data persistence - we do mount to GCS buckets though). Cloud Run allows only one port to be exposed and this is served at :443, plus it automatically adds SSL certificates.

Therefore, I have a Neo4J database in Docker, deployed as a Cloud Run instance, exposing 7687 at 443.

I have also configured the Neo4j environment variables by following the official instructions.

**The problem:**

The deployment is successful and **I am also able to use my Neo4J Desktop app to connect remotely to the database** and interact with it, BUT **I cannot connect to it using neo4j-python, py2neo or cypher-shell.**

Here is the log output from neo4j-python:

> [#0000] \_: \<POOL\> created, direct address IPv4Address((‘\<database-uri\>’, 443))  
> [#0000] \_: \<POOL\> acquire direct connection, access\_mode='WRITE', database='neo4j'  
> [#0000] \_: \<POOL\> trying to hand out new connection  
> [#0000] \_: \<RESOLVE\> in: \<database-uri\>:443  
> [#0000] \_: \<RESOLVE\> dns resolver out: \<google-cloud-ip\>:443  
> [#0000] C: \<OPEN\> \<google-cloud-ip\>:443  
> [#FB7A] C: \<SECURE\> \<database-uri\>  
> [#FB7A] C: \<MAGIC\> 0x6060B017  
> [#FB7A] C: \<HANDSHAKE\> 0x00040405 0x00020404 0x00000104 0x00000003  
> [#FB7A] S: \<CONNECTION FAILED\> ServiceUnavailable: Failed to read any data from server ResolvedIPv4Address((‘\<google-cloud-ip\>’, 443)) after connected (deadline Deadline(timeout=60.0))  
> [#0000] \_: \<RESOLVE\> dns resolver out: \<google-cloud-ip\>:443  
> [#0000] C: \<OPEN\> \<google-cloud-ip\>:443  
> [#FB85] C: \<SECURE\> \<database-uri\>  
> [#FB85] C: \<MAGIC\> 0x6060B017  
> [#FB85] C: \<HANDSHAKE\> 0x00040405 0x00020404 0x00000104 0x00000003  
> [#FB85] S: \<CONNECTION FAILED\> ServiceUnavailable: Failed to read any data from server ResolvedIPv4Address((‘’, 443)) after connected (deadline Deadline(timeout=60.0))  
> [#0000] \_: \<RESOLVE\> dns resolver out: :443  
> [#0000] C: \<OPEN\> \<google-cloud-ip\>:443  
> [#FB86] C: \<SECURE\> \<database-uri\>  
> [#FB86] C: \<MAGIC\> 0x6060B017  
> [#FB86] C: \<HANDSHAKE\> 0x00040405 0x00020404 0x00000104 0x00000003  
> [#FB86] S: \<CONNECTION FAILED\> ServiceUnavailable: Failed to read any data from server ResolvedIPv4Address((‘\<google-cloud-ip\>’, 443)) after connected (deadline Deadline(timeout=60.0))  
> [#0000] \_: \<RESOLVE\> dns resolver out: \<google-cloud-ip\>:443  
> [#0000] C: \<OPEN\> \<google-cloud-ip\>:443  
> [#FB87] C: \<SECURE\> \<database-uri\>  
> [#FB87] C: \<MAGIC\> 0x6060B017  
> [#FB87] C: \<HANDSHAKE\> 0x00040405 0x00020404 0x00000104 0x00000003  
> [#FB87] S: \<CONNECTION FAILED\> ServiceUnavailable: Failed to read any data from server ResolvedIPv4Address((‘\<google-cloud-ip\>’, 443)) after connected (deadline Deadline(timeout=60.0))  
> [#0000] \_: \<POOL\> close

Basically, the script times out and cannot connect. On Cloud Run I don’t see any message in the logs, like there is no attempt from a client to connect. I ‘ve checked everywhere online and have tried many different things but have not been able to come up with a solution.

I don’t see how is it possible to connect using Neo4j Desktop, but not neo4j-python or cypher-shell.  
Does this mean that I should try to figure out the problem only on the client-side and the server is working fine?  
If so, what is Neo4j Desktop doing internally that makes it able to connect and how to replicate it using neo4j-python?

Any help would be much appreciated!  
Thanks
