Error - Cannot read property 'constructor' of null while using Neovis.js

cypher
operations
import

(Sucheta) #1

Information:

  • neo4j version - 3.4.7 Enterprise,
    browser version - Version 3.4.7
  • what kind of API / driver do you use - I am using Neovis.js

With cypher query -
var cypherQuery =

  "MATCH (n) OPTIONAL MATCH (n)-[r]->(m) RETURN n,r,m LIMIT 10";

I get proper response -

Issue - I get an error message
ERROR TypeError: Cannot read property 'constructor' of null

when my Limit in the cypher query increases beyond 10.

(say )- var cypherQuery =

     "MATCH (n) OPTIONAL MATCH (n)-[r]->(m) RETURN n,r,m LIMIT 15";

complete log of error -

ERROR TypeError: Cannot read property 'constructor' of null
at neovis.js:36514
at Record.forEach (neovis.js:33630)
at Object.onNext (neovis.js:36511)
at _RunObserver.onNext (neovis.js:33014)
at Connection._handleMessage (neovis.js:31442)
at Dechunker.Connection._dechunker.onmessage (neovis.js:31392)
at Dechunker._onHeader (neovis.js:30537)
at Dechunker.AWAITING_CHUNK (neovis.js:30490)
at Dechunker.write (neovis.js:30548)
at WebSocketChannel.self._ch.onmessage (neovis.js:31365)

Please help.

Source code -

    const url = 'bolt://localhost:11001';
    const username = 'neo4j';
    const password = 'Viralabc';
     const encrypted = true;

   var cypherQuery = "MATCH (n) OPTIONAL MATCH (n)-[r]->(m) RETURN n,r,m LIMIT 15";

   var config = {
    container_id: "viz",
    server_url: "bolt://localhost:11001",
    server_user: "neo4j",
    server_password: "Virtuallib1",
    labels: {
     
        "Banking": {
            "caption": "name",
            "size": "pagerank",
            "community": "community"
           
        }
      },
       relationships: {
          "cc": {
            "thickness": "weight",
            "caption": false
         }
        },
   
        initial_cypher:cypherQuery ,        
        arrows: true,
        hierarchical_layout:true,
         hierarchical_sort_method:"directed",
   
     };                 
     this.viz = new NeoVis.default(config);  

     this.viz.render();
     console.log(this.viz);

(William Lyon) #2

I'm not certain, but it looks like neovis.js may not be properly handling nulls returned in the Cypher query as a result of using OPTIONAL MATCH.

Could you please create a Github issue here and we will investigate further and fix: https://github.com/neo4j-contrib/neovis.js/issues


Errors in code when using Neovis.js with angular2+ template
(Sucheta) #3

Hi William,

I have included the issue in github . Link -


(William Lyon) #4

Great - thanks! Let's track the problem there and I'll try to get it fixed soon, I think I see what is going on.


(William Lyon) #6