neo4j-graphql-js
neo4j-graphql-js copied to clipboard
@cypher query causes Failed to invoke function `apoc.cypher.runFirstColumn`
Glitch: https://glitch.com/edit/#!/slash-oyster?path=src/graphql-schema.js:13:18
When using this schema definition, along with a Recommendations neo4j sandbox the result of sending a GraphQL query results in an Assertion Failure:
{
"data": {
"moviesByTitle": null
},
"errors": [
{
"message": "Failed to invoke function `apoc.cypher.runFirstColumn`: Caused by: java.lang.AssertionError: assertion failed",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"moviesByTitle"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"code": "Neo.ClientError.Procedure.ProcedureCallFailed",
"name": "Neo4jError",
"stacktrace": [
"Neo4jError: Failed to invoke function `apoc.cypher.runFirstColumn`: Caused by: java.lang.AssertionError: assertion failed",
"",
" at captureStacktrace (/rbd/pnpm-volume/696f00f8-8ee1-47d1-94bb-2b25f762f3a1/node_modules/.registry.npmjs.org/neo4j-driver/1.6.2/node_modules/neo4j-driver/lib/v1/result.js:200:15)",
" at new Result (/rbd/pnpm-volume/696f00f8-8ee1-47d1-94bb-2b25f762f3a1/node_modules/.registry.npmjs.org/neo4j-driver/1.6.2/node_modules/neo4j-driver/lib/v1/result.js:73:19)",
" at Session._run (/rbd/pnpm-volume/696f00f8-8ee1-47d1-94bb-2b25f762f3a1/node_modules/.registry.npmjs.org/neo4j-driver/1.6.2/node_modules/neo4j-driver/lib/v1/session.js:116:14)",
" at Session.run (/rbd/pnpm-volume/696f00f8-8ee1-47d1-94bb-2b25f762f3a1/node_modules/.registry.npmjs.org/neo4j-driver/1.6.2/node_modules/neo4j-driver/lib/v1/session.js:95:19)",
" at _callee$ (/rbd/pnpm-volume/696f00f8-8ee1-47d1-94bb-2b25f762f3a1/node_modules/.registry.npmjs.org/neo4j-graphql-js/0.2.1/node_modules/neo4j-graphql-js/dist/index.js:76:28)",
" at tryCatch (/rbd/pnpm-volume/696f00f8-8ee1-47d1-94bb-2b25f762f3a1/node_modules/.registry.npmjs.org/regenerator-runtime/0.11.1/node_modules/regenerator-runtime/runtime.js:62:40)",
" at Generator.invoke [as _invoke] (/rbd/pnpm-volume/696f00f8-8ee1-47d1-94bb-2b25f762f3a1/node_modules/.registry.npmjs.org/regenerator-runtime/0.11.1/node_modules/regenerator-runtime/runtime.js:296:22)",
" at Generator.prototype.(anonymous function) [as next] (/rbd/pnpm-volume/696f00f8-8ee1-47d1-94bb-2b25f762f3a1/node_modules/.registry.npmjs.org/regenerator-runtime/0.11.1/node_modules/regenerator-runtime/runtime.js:114:21)",
" at step (/rbd/pnpm-volume/696f00f8-8ee1-47d1-94bb-2b25f762f3a1/node_modules/.registry.npmjs.org/babel-runtime/6.26.0/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)",
" at /rbd/pnpm-volume/696f00f8-8ee1-47d1-94bb-2b25f762f3a1/node_modules/.registry.npmjs.org/babel-runtime/6.26.0/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14"
]
}
}
}
]
}
It doesnt appear to be specific to the javascript library, using the query directly in the Neo4j Browser results in the same error.
WITH apoc.cypher.runFirstColumn("MATCH (m:Movie) WHERE m.title CONTAINS $subString RETURN m", {subString:'Matrix'}, True) AS x UNWIND x AS movie
RETURN movie { .title ,genres: [(movie)-[:IN_GENRE]->(movie_genres:Genre) | movie_genres { .name }] ,similar: [ movie_similar IN apoc.cypher.runFirstColumn("WITH this as m
MATCH (m)-[:IN_GENRE]->(g:Genre)<-[:IN_GENRE]-(movie:Movie)
WITH m, movie, COUNT(*) AS genreOverlap
MATCH (m)<-[:RATED]-(:User)-[:RATED]->(movie:Movie)
WITH movie,genreOverlap, COUNT(*) AS userRatedScore
RETURN movie
ORDER BY (0.9 * genreOverlap) + (0.1 * userRatedScore) DESC", {this: movie, first: 3, offset: 0}, true) | movie_similar { .title }] } AS movie
Neo.ClientError.Procedure.ProcedureCallFailed
Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke function `apoc.cypher.runFirstColumn`: Caused by: java.lang.AssertionError: assertion failed
Failing Cypher query:
WITH this as m
MATCH (m)-[:IN_GENRE]->(g:Genre)<-[:IN_GENRE]-(movie:Movie)
WITH m, movie, COUNT(*) AS genreOverlap
MATCH (m)<-[:RATED]-(:User)-[:RATED]->(movie:Movie)
WITH movie,genreOverlap, COUNT(*) AS userRatedScore
RETURN movie
ORDER BY (0.9 * genreOverlap) + (0.1 * userRatedScore) DESC
Modified query that works: (note the removal of genreOverlap)
WITH this as m
MATCH (m)-[:IN_GENRE]->(g:Genre)<-[:IN_GENRE]-(movie:Movie)
WITH m, movie
MATCH (m)<-[:RATED]-(:User)-[:RATED]->(movie:Movie)
WITH movie, COUNT(*) AS userRatedScore
RETURN movie
ORDER BY (0.1 * userRatedScore) DESC
https://github.com/neo4j-graphql/neo4j-graphql-js/issues/608