I'm attempting to create a custom cypher query through the neo4j-graphql-js driver. I've found the documentation pretty useful but for some reason I'm getting stuck. I've created this query in my schema:
When I attempt to run this in the GraphiQL playground like this:
query{
mineralTotal(name: "mpi")
}
The error message I get back is: "Cannot read property 'selections' of undefined". I'm sure it's because I'm not specifying a return but I don't know what to ask for back? Any suggestions?
Hey @MuddyBootsCode I remember running across this before - it seems we hadn't considered the case where a custom Query field would return a scalar and not an object.
As a workaround you could try adding mineralTotal as a field on the Owner type, instead of on the root query:
BTW - you can use the auto-generated ordering field orderBy with these custom computed fields as well, just be aware that if your graph is large enough you might see some performance impacts as those sub-queries will be run over every Owner node to be able to sort.
I have no idea what happened but literally overnight the code that was working to create these queries broke. Now when I try to run any of the queries that were working before like:
I've done nothing. No updates, no changes to the code. But this was all working when I did the queries from the previous posts and now. Nothing. Any ideas?
" at captureStacktrace (/Users/mbp/WebstormProjects/landmachine_api/node_modules/neo4j-driver/lib/v1/result.js:200:15)",
" at new Result (/Users/mbp/WebstormProjects/landmachine_api/node_modules/neo4j-driver/lib/v1/result.js:73:19)",
" at _newRunResult (/Users/mbp/WebstormProjects/landmachine_api/node_modules/neo4j-driver/lib/v1/transaction.js:342:10)",
" at Object.run (/Users/mbp/WebstormProjects/landmachine_api/node_modules/neo4j-driver/lib/v1/transaction.js:251:14)",
" at Transaction.run (/Users/mbp/WebstormProjects/landmachine_api/node_modules/neo4j-driver/lib/v1/transaction.js:120:26)",
" at /Users/mbp/WebstormProjects/landmachine_api/node_modules/neo4j-graphql-js/dist/index.js:78:25",
" at TransactionExecutor._safeExecuteTransactionWork (/Users/mbp/WebstormProjects/landmachine_api/node_modules/neo4j-driver/lib/v1/internal/transaction-executor.js:136:22)",
" at TransactionExecutor._executeTransactionInsidePromise (/Users/mbp/WebstormProjects/landmachine_api/node_modules/neo4j-driver/lib/v1/internal/transaction-executor.js:124:32)",
" at /Users/mbp/WebstormProjects/landmachine_api/node_modules/neo4j-driver/lib/v1/internal/transaction-executor.js:67:15",
" at new Promise (<anonymous>)"
Could you try pinning to version 2.3.1? We updated some of the handling for scalar Cypher directive fields in 2.4.0 and I wonder if maybe we broke something there.