The cypher directive on a field-level does not work as expected.
Minimal example:
type Question {
id: ID! @id
required: Boolean
testing(someId: ID!): Boolean
@cypher(statement: """
MATCH (q:Question {id:$someId}) RETURN q.required
""")
}
When running the below query, I'm getting an error.
{
Question {
testing(someId: "12345678-1234-1234-1234-0123456789ab")
}
}
This is the error log as seen in the Apollo Playground:
{ "errors": [ { "message": "Invalid input '_someId': expected\n "!="\n "%"\n ""\n "+"\n ","\n "-"\n "."\n "/"\n ":"\n "<"\n "<="\n "<>"\n "="\n "=~"\n ">"\n ">="\n "AND"\n "CONTAINS"\n "ENDS"\n "IN"\n "IS"\n "OR"\n "STARTS"\n "XOR"\n "["\n "^"\n "}" (line 1, column 195 (offset: 194))\n"MATCH (
question
:Question
) RETURNquestion
{testing: apoc.cypher.runFirstColumn("MATCH (q:Question {id:$someId}) RETURN q.required", {this: question, cypherParams: $cypherParams, someId: $1_someId}, false)} ASquestion
"\n
^", "locations": [ { "line": 2, "column": 3 } ], "path": [ "Question" ], "extensions": { "code": "INTERNAL_SERVER_ERROR", "exception": { "code": "Neo.ClientError.Statement.SyntaxError", "name": "Neo4jError", "stacktrace": [ "Neo4jError: Invalid input '_someId': expected", " "!="", " "%"", " """, " "+"", " ","", " "-"", " "."", " "/"", " ":"", " "<"", " "<="", " "<>"", " "="", " "=~"", " ">"", " ">="", " "AND"", " "CONTAINS"", " "ENDS"", " "IN"", " "IS"", " "OR"", " "STARTS"", " "XOR"", " "["", " "^"", " "}" (line 1, column 195 (offset: 194))", ""MATCH (question
:Question
) RETURNquestion
{testing: apoc.cypher.runFirstColumn("MATCH (q:Question {id:$someId}) RETURN q.required", {this: question, cypherParams: $cypherParams, someId: $1_someId}, false)} ASquestion
"", " ^", ": ", " at captureStacktrace (/home/m1/citizentric/grand-housing/node_modules/neo4j-driver-core/lib/result.js:239:17)", " at new Result (/home/m1/citizentric/grand-housing/node_modules/neo4j-driver-core/lib/result.js:59:23)", " at newCompletedResult (/home/m1/citizentric/grand-housing/node_modules/neo4j-driver-core/lib/transaction.js:372:12)", " at Object.run (/home/m1/citizentric/grand-housing/node_modules/neo4j-driver-core/lib/transaction.js:226:20)", " at Transaction.run (/home/m1/citizentric/grand-housing/node_modules/neo4j-driver-core/lib/transaction.js:98:34)", " at _callee3$ (/home/m1/citizentric/grand-housing/node_modules/neo4j-graphql-js/dist/index.js:226:35)", " at tryCatch (/home/m1/citizentric/grand-housing/node_modules/regenerator-runtime/runtime.js:63:40)", " at Generator.invoke [as _invoke] (/home/m1/citizentric/grand-housing/node_modules/regenerator-runtime/runtime.js:293:22)", " at Generator.next (/home/m1/citizentric/grand-housing/node_modules/regenerator-runtime/runtime.js:118:21)", " at asyncGeneratorStep (/home/m1/citizentric/grand-housing/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator/index.js:5:24)", " at _next (/home/m1/citizentric/grand-housing/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator/index.js:27:9)", " at /home/m1/citizentric/grand-housing/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator/index.js:34:7", " at new Promise ()", " at new F (/home/m1/citizentric/grand-housing/node_modules/@babel/runtime-corejs2/node_modules/core-js/library/modules/_export.js:36:28)", " at /home/m1/citizentric/grand-housing/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator/index.js:23:12", " at /home/m1/citizentric/grand-housing/node_modules/neo4j-graphql-js/dist/index.js:241:30" ] } } } ], "data": { "Question": null } }
My package.json includes these versions:
"apollo-server": "^2.25.0",
"apollo-server-core": "^2.25.0",
"graphql-tag": "^2.12.5",
"neo4j-driver": "^4.3.1",
"neo4j-graphql-js": "^2.19.2",
Top-level queries (with arguments) and field-level queries with the cypher decorator work fine as long as these do not accept parameters. I was under the impression that this has worked earlier.