Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Custom root @cypher query without arguments throws an error #175

Closed
smkhalsa opened this issue Jan 11, 2019 · 1 comment
Closed

Custom root @cypher query without arguments throws an error #175

smkhalsa opened this issue Jan 11, 2019 · 1 comment

Comments

@smkhalsa
Copy link
Contributor

If I create a custom @cypher query on the root query type in my schema with no arguments, it throws an error. This appears to be due to the fact that without query arguments, the second field of apoc.cypher.runFirstColumn is empty.

I have the following in my schema:

type Album implements SongCollection {
  id: ID!
  name: String!
  songs: [Song!]! @cypher(statement: "MATCH (this)-[r:HAS_SONG]->(s:Song) RETURN s ORDER BY r.number")
  imageName: String  
  artists: [Artist!]! @relation(name: "BY_ARTIST", direction: "OUT")
  songRelations: [SongAlbumRelation!]!
}

type Query {
  PopularAlbums: [Album!]! @cypher(statement: "Match (a:Album) return a ORDER BY a.name")
}

If I make the this query:

query {
  PopularAlbums {
    name
  }
}

I get this error:

{
  "errors": [
    {
      "message": "Invalid input ',': expected whitespace, comment or an expression (line 1, column 77 (offset: 76))\n\"WITH apoc.cypher.runFirstColumn(\"Match (a:Album) return a ORDER BY a.name\", , True) AS x UNWIND x AS `album`\"\n                                                                             ^",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "PopularAlbums"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "code": "Neo.ClientError.Statement.SyntaxError",
          "name": "Neo4jError",
          "stacktrace": [
            "Neo4jError: Invalid input ',': expected whitespace, comment or an expression (line 1, column 77 (offset: 76))",
            "\"WITH apoc.cypher.runFirstColumn(\"Match (a:Album) return a ORDER BY a.name\", , True) AS x UNWIND x AS `album`\"",
            "                                                                             ^",
            "",
            "    at captureStacktrace (/Users/smkhalsa/code/kundalini-server/node_modules/neo4j-driver/lib/v1/result.js:200:15)",
            "    at new Result (/Users/smkhalsa/code/kundalini-server/node_modules/neo4j-driver/lib/v1/result.js:73:19)",
            "    at Session._run (/Users/smkhalsa/code/kundalini-server/node_modules/neo4j-driver/lib/v1/session.js:173:14)",
            "    at Session.run (/Users/smkhalsa/code/kundalini-server/node_modules/neo4j-driver/lib/v1/session.js:154:19)",
            "    at _callee$ (/Users/smkhalsa/code/kundalini-server/node_modules/neo4j-graphql-js/dist/index.js:60:28)",
            "    at tryCatch (/Users/smkhalsa/code/kundalini-server/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:62:40)",
            "    at Generator.invoke [as _invoke] (/Users/smkhalsa/code/kundalini-server/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:296:22)",
            "    at Generator.prototype.(anonymous function) [as next] (/Users/smkhalsa/code/kundalini-server/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:114:21)",
            "    at step (/Users/smkhalsa/code/kundalini-server/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)",
            "    at /Users/smkhalsa/code/kundalini-server/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14"
          ]
        }
      }
    }
  ],
  "data": null
}
@smkhalsa
Copy link
Contributor Author

duplicate of #177 - github gave a server error, so I resubmitted

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant