Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-26-2021 03:39 AM
Hi! It's my first time posting here so please advise if anything isn't clear!
I'm coming across a cypher exception when executing a query with an array parameter via graphql. A simplified version of the query I'm trying to execute is as follows:
CreateTaskWithAsignees(input: ContributionInput): Contribution @cypher(statement: """
CREATE (task: Contribution $input)
WITH task
UNWIND $input.taskMemberIds AS memberId
MATCH (asignee:Person{id: memberId})
MERGE (task)<-[:CONTRIBUTED]-(asignee)
RETURN task
""")
I'm providing the following parameter:
{
"input": {
"title": "Create a relationship between a new Task node and potentially multiple asignees",
"taskGroup": "General",
"status": "To Do",
"taskMemberIds": [
"91f851db-b48f-48ee-8ef4-199ebfe9f701",
"6a59d48e-d3ae-4472-8f29-91918a49f096"
]
}
}
I can run the query in neo4j browser and it does what I want... but when I try and execute via graphql query, I get the following exception:
{
"errors": [
{
"message": "Failed to invoke procedure `apoc.cypher.doIt`: Caused by: org.neo4j.cypher.internal.v3_5.util.CypherTypeException: Property values can only be of primitive types or arrays thereof",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"CreateTaskWithAsignees"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"code": "Neo.ClientError.Procedure.ProcedureCallFailed",
"name": "Neo4jError"
}
}
}
],
"data": {
"CreateTaskWithAsignees": null
}
}
Something I suspect is the problem (but I don't know why it's happening!) that I can see in the logs is that the taskMemberIds
field of the input
parameter is structured like an object instead of an array:
"input": {
"title": "Create a task in Delic",
"status": "To Do",
"taskGroup": "General",
"taskMemberIds": {
"0": "91f851db-b48f-48ee-8ef4-199ebfe9f701",
"1": "6a59d48e-d3ae-4472-8f29-91918a49f096"
}
},
If anyone could advise as to what's going on, or think of anything I could do to get around it, I'd really appreciate it! Thanks
All the sessions of the conference are now available online