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.

Neo4j-driver not generating proper cypher queries

aqureshi
Node Link

EDIT: solved... my database version was 3.0 and it worked when I switched it to 3.2 instead
Hi,

I'm running the basic neo4j-driver example in node. In my database i'm running the example movie graph provided by the browser console.

this is what my typeDefs look like (autogenerating the resolvers):

const typeDefs = `
type Movie {
	title: String
	released: Int
	id: ID
	tagline: String
}
`;

When I run the code and the graphql playground starts up, this is what I see in the schema:

2X_3_3b3704222adbe1359bf2d692d04f7fa421ac2a6a.png

When I run this query:

{
  Movie(title: "A Few Good Men"){
    released
  }
}

the cypher query that gets auto-generated is:

MATCH (movie:Movie {title:$title}) RETURN movie { .released } AS movie SKIP $offset
{ offset: 0, first: -1, title: 'A Few Good Men' }

and the error response i get back is:

"message": "Invalid input '.': expected whitespace, comment, a property key name, '}', an identifier or UnsignedDecimalInteger (line 1, column 51 (offset: 50))\n\"MATCH (movie:Movie {title:$title}) RETURN movie { .released } AS movie SKIP $offset\"\n 

Any ideas with what could be wrong? Thanks!

EDIT: this is what my index.js looks like:

require('dotenv').config();
import {v1 as neo4j } from 'neo4j-driver';
import { ApolloServer } from 'apollo-server';
import { makeAugmentedSchema } from 'neo4j-graphql-js';

const typeDefs = `
type Movie {
	title: String
	released: Int
	id: ID
	tagline: String
}
`;

const schema = makeAugmentedSchema({ typeDefs });

const driver = neo4j.driver(
    process.env.NEO4J_BOLT_URL,
    neo4j.auth.basic(process.env.NEO4J_USER, process.env.NEO4J_PASS)
);

const server = new ApolloServer({ schema, context: { driver } });

server.listen(3003, '0.0.0.0').then(({ url }) => {
    console.log(`GraphQL API ready at ${url}`);
});

1 REPLY 1

William_Lyon
Graph Fellow

OK great - I'm glad the issue was resolved by upgrading the version of Neo4j. Our GraphQL integrations use map projections, which are a relatively new Cypher feature introduced in Neo4j v3.1