cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Graphql_flutter Failed to connect to local database

Hey everyone, I am trying to build a Flutter app that will use Neo4j as database.
I am new to programming and new to Neo4j.
The plugin graphql_flutter should allow me to communicate with the database through using GraphQL.
I created a test app that fetches data from a freely available database and that works, so the code should be good. Here is the code : https://github.com/louisdeveseleer/graphql_app/blob/master/main.dart

Here are the steps I followed on the Neo4j side:
-Create a local database on Neo4j desktop
-Install the GraphQL plugin
-Remove authentication for this database (to make things easier to start with) with the setting dbms.security.auth_enabled=false
-Populate this database with the sample movie data :play movie
-Automatically generate the graphql schema (CALL graphql.idl(null);)
-Launch GraphiQL and connect to http://localhost:7474/graphql/
-Test a query:

{Movie{
        title
      }
}

which returned a list of movies, so everything seems to be set up right.

Here is the issue:
When in the Flutter app I replace the line for the HttpLink
uri: 'https://countries.trevorblades.com/' (used for testing)
by
uri: 'http://localhost:7474/graphql/'
then i get this error on the app screen:
ClientException: Failed to connect to http://localhost:7474/graphql/:

And since it is working with GraphiQL, I don't know what to do here.

8 REPLIES 8

Hi Louis,
Some questions:

• Which version of neo4j are you using?
• Were you able to connect at some point with some other code?
• Did you test the connection directly via neo4j desktop | browser?

Hi!

  • Neo4j 4.0.1
  • It's the first time I am trying to connect to my local database with a code
  • I can access the database by going into a browser and typing http://localhost:7474/browser/ (or through the desktop)

I never used the flutter connection, but have you tried the bolt connection?

How can I do that?
Typing bolt://localhost:7687 in the browser does not work.

I am now trying Google cloud platform to host and access my database through GraphQL. The hosting of the database is up and running but I struggle to find exactly how to install a graphql plugin on it.

Were you able to figure anything out? I'm about to try Flutter - Neo4j too

No. I switched to Firebase and everything is much easier to setup and manage. I still like the idea of a graph database, but the implementation is just too technically difficult to be worth it in my case.