Combining Cypher and GraphQL unable to traverse relationship node

257 Views Asked by At

I am new to Neo4j and have been learning for the past few days about using GraphQL with Neo4j through Grandstack. I've been working through this Guide and this Repository working on setting up schemes. I've been working off of the sample neo4j movie database Im attempting to do a basic query where I select the movie by rating using a cypher query as shown below. How ever when testing in the browser I am receiving the following error. Any idea how to fix this or what I am doing wrong thank you

   const typeDefs = `
type Movie {
    title: String
    tagLine: String
    released: Int 
    reviews: [Reviewed] 
}
type Reviewed @relation(name: "REVIEWED"){
    from: Person
    to: Movie
    summary: String
    rating: String
}
type Person {
    name: String
    born: Int
    actedIn: [Movie] @relation(name: "ACTED_IN",direction:"OUT")
}

type Query {
    Movie(title: String ,released: Int, first: Int, offset: Int): [Movie]
    ReviewsByScore(score: Int): [Reviewed] @cypher(statement: "MATCH()-[r:REVIEWED]-() WHERE r.rating >= $score RETURN r;")
}
`;

const schema = neo4jgraphql.makeAugmentedSchema({ typeDefs });

In the browser I run the following query

{
  ReviewsByScore(score: 100) {
    rating
    summary
    to{
      title
    }
  }
}

and receive the following error.

{ "errors": [ { "message": "Cannot read property 'value' of undefined", "locations": [ { "line": 2, "column": 3 } ], "path": [ "ReviewsByScore" ], "extensions": { "code": "INTERNAL_SERVER_ERROR", "exception": { "stacktrace": [ "TypeError: Cannot read property 'value' of undefined", " at getRelationTypeDirective (/Users/a123456/Desktop/Neo4j Test Javascript/node_modules/neo4j-graphql-js/dist/utils.js:763:7)", " at buildCypherSelection (/Users/a123456/Desktop/Neo4j Test Javascript/node_modules/neo4j-graphql-js/dist/selections.js:184:64)", " at recurse (/Users/a123456/Desktop/Neo4j Test Javascript/node_modules/neo4j-graphql-js/dist/selections.js:87:33)", " at buildCypherSelection (/Users/a123456/Desktop/Neo4j Test Javascript/node_modules/neo4j-graphql-js/dist/selections.js:176:12)", " at recurse (/Users/a123456/Desktop/Neo4j Test Javascript/node_modules/neo4j-graphql-js/dist/selections.js:87:33)", " at buildCypherSelection (/Users/a123456/Desktop/Neo4j Test Javascript/node_modules/neo4j-graphql-js/dist/selections.js:176:12)", " at customQuery (/Users/a123456/Desktop/Neo4j Test Javascript/node_modules/neo4j-graphql-js/dist/translate.js:575:68)", " at translateQuery (/Users/a123456/Desktop/Neo4j Test Javascript/node_modules/neo4j-graphql-js/dist/translate.js:518:12)", " at cypherQuery (/Users/a123456/Desktop/Neo4j Test Javascript/node_modules/neo4j-graphql-js/dist/index.js:146:40)", " at _callee$ (/Users/a123456/Desktop/Neo4j Test Javascript/node_modules/neo4j-graphql-js/dist/index.js:73:31)" ] } } } ], "data": { "ReviewsByScore": null } }

0

There are 0 best solutions below