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.

Type CartesianPoint : [GraphQL error]: Message: Cannot read property 'x' of undefined

Hello,
We would like to migrate from neo4j-graphql-js to Neo4j GraphQL Library.
We got an issue with CartesianPoint and can't find the solution.

Here's the problem. We've a custom resolver that return a Post object (which match our schema). Everything works except the field with CartesianPoint (from a nested object) who return this error:
[GraphQL error]: Message: Cannot read property 'x' of undefined,

In front it's fetched via GraphQL like this:

Post {
  CustomFieldContent {
   [...]
    value_spatial {
      x
      y
    }
  }
}

On backend, when we log our Post object we've a correct object for value_spatial. If no value, it's null. Else, when we got a value, we've tested 2 differents approach to define the object (both return the previous error) :

  1. Cusom => value_spatial: { x: 46.19863361913244, y: 6.140601539612646 }
  2. Cypher Point object => value_spatial: Point {
    srid: [Integer],
    x: 46.19863361913244,
    y: 6.140601539612646,
    z: undefined
    }

Here's our types:

  type  CustomFieldContent {
         [...]
        post: Post @cypher(statement: "MATCH (this)<-[:DEFINED_WITH]-(post) RETURN post"),
       value_spatial: CartesianPoint,
    }
  type Post {
         [...]
          customFieldContents: [CustomFieldContent] @cypher(statement: "MATCH (this)-[:DEFINED_WITH]->(cfc) RETURN cfc ORDER BY cfc.field_order")
 }

It seems the issue comes from the Neo4j GraphQL Library as the object we retrun thru the resolver is correct (and was working with neo4j-graphql-js).

FYI, we've also tested to replace custom @cypher statement with traditional @relationhship approach but it doesn't change the behaviour.

Any idea where is the problem?

Thank you

Jonas

1 ACCEPTED SOLUTION

Ok, we've found the solution by exploring Neo4j Graphql Library source code.
For anybody who got same problem, in order to make it work it's needed to include CartesianPoint value into a point object to be handled correctly by the library:

value_spatial: { 
    point {
       x: 46.19863361913244,
      y: 6.140601539612646,
     }
}

View solution in original post

1 REPLY 1

Ok, we've found the solution by exploring Neo4j Graphql Library source code.
For anybody who got same problem, in order to make it work it's needed to include CartesianPoint value into a point object to be handled correctly by the library:

value_spatial: { 
    point {
       x: 46.19863361913244,
      y: 6.140601539612646,
     }
}