0

I have deployed a flask app via zappa. The flask app makes a call to graphene, a service running neo4j db instances. I can connect to graphene through the terminal like this

from neo4j.v1 import GraphDatabase, basic_auth

        driver = GraphDatabase.driver(
            app.config['NEO4J_CONNECTION_URL'],
            auth=basic_auth(app.config['NEO4J_CONNECTION_USERNAME'], app.config['NEO4J_CONNECTION_PASSWORD']),
            encrypted=IS_ENCRYPTED
        )

, flagging driver as unencrypted, and can run queries, etc. However, when I deploy this to AWS I get the error listed in the title, Errno 104 - connection reset by peer.

Stuck on this, not sure if there is other relevant info that would help solve the problem.

Mark B
  • 139,343
  • 19
  • 240
  • 237
pauld
  • 361
  • 1
  • 3
  • 17
  • Are you sure the app.config values are being loaded correctly in the Lambda function? You might try adding some logging to verify that. Also, does your function have network access to the database? Is the database in your VPC or outside the VPC? Did you place your Lambda function inside your VPC? – Mark B Oct 19 '16 at 19:33
  • app.config values are definitely correct. The lambda function connects to (or tries to connect to ) graphene in the way their service describes. Graphene is not part of AWS, so I suppose by default its outside of the VPC. I deployed this through zappa, a python package, which takes care of most of the AWS set up so I'm not sure about where the lambda function is housed, but I believe it is outside of any VPC. – pauld Oct 19 '16 at 19:47
  • I'm also having problems with Neo4J driver inside a lambda function although I'm using the node version. The node version defaults to 'TRUST_ON_FIRST_USE' for the TLS setup. With this config the driver wants to write a known_hosts file which I'm guessing is the cause of the problem running inside a lambda function in my case. Might be worth looking for something similar in your case with the python driver. – Peter Whitfield Oct 25 '16 at 00:55
  • got my nodejs bolt driver working by configuring knownHosts when setting up the driver. A lambda function can write to /tmp, so I've defined the knownHosts path as `/tmp/.neo4j/known_hosts` whereas the default is `~/.neo4j/known_hosts` which isn't writable by the lambda function. Not sure if this also applies to the python driver – Peter Whitfield Oct 25 '16 at 01:18

0 Answers0