Bug: args.schema.getRootType is not a function after running The Graph Client DevTools
schmidsi opened this issue · comments
I'm trying to use the simplest setup of Graph Client to just query my local Graph Node. When I runpnpm graphclient serve-dev
and run any query in the exposed GraphiQL interface, I receive the following error:
{
"errors": [
{
"message": "args.schema.getRootType is not a function"
}
]
}
Steps to reproduce
You need to have docker installed and running
- Clone this repo and checkout this commit: schmidsi/hackathon-starterkit@36017cb
- Run the quick start instructions:
pnpm install
,pnpm dev
,pnpm quickstart
- Go into frontend folder:
cd frontend
- Build the Graph Client:
pnpm graphclient build
- Serve the debug server:
pnpm graphclient serve-dev
- Go to http://localhost:4000/graphql?query=query+MyQuery+%7B%0A++approvals+%7B%0A++++id%0A++%7D%0A%7D and run the query
Not sure if related but if I try to query through Graph Client I see the following warning in the browser:
../node_modules/.pnpm/@graphql-mesh+utils@0.41.20_frfeqt5y6urghbnh4docfsx6zy/node_modules/@graphql-mesh/utils/index.mjs
Critical dependency: the request of a dependency is an expression hot-dev-client.js:85:24
../node_modules/.pnpm/@graphql-tools+url-loader@7.16.4_otuvekqdquydy6klgbn7fidsmy/node_modules/@graphql-tools/url-loader/esm/index.js
Critical dependency: the request of a dependency is an expression
Could you try with the latest versions? Thanks!
Also could you create a minimal example on CodeSandbox please becauze I had some issues while running the remote API?
Ok, I stripped down the repo to frontend only and pointed to an online subgraph. Here is the CodeSandbox link: https://codesandbox.io/p/github/schmidsi/graph-client-bug-/draft/recursing-scooby?file=%2FREADME.md&workspace=%257B%2522activeFileId%2522%253A%2522cl9ihdaxt0002lqhd8svv4adc%2522%252C%2522openFiles%2522%253A%255B%2522%252FREADME.md%2522%255D%252C%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522gitSidebarPanel%2522%253A%2522COMMIT%2522%252C%2522sidekickItems%2522%253A%255B%257B%2522type%2522%253A%2522TERMINAL%2522%252C%2522shellId%2522%253A%2522cl9ihe1wd000tlqhdhdb5chmu%2522%252C%2522key%2522%253A%2522cl9ihe1t100dc3b5xcem5tt82%2522%252C%2522isMinimized%2522%253Afalse%257D%252C%257B%2522type%2522%253A%2522SETUP_SHELL_LOG%2522%252C%2522shellId%2522%253A%2522cl9ihdb39000ilqhd6pbfbagx%2522%252C%2522isMinimized%2522%253Atrue%252C%2522key%2522%253A%2522cl9ihdb39000ilqhd6pbfbagx%2522%257D%252C%257B%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522key%2522%253A%2522cl9ihdlqe006q3b5xx5eobqo8%2522%252C%2522isMinimized%2522%253Afalse%257D%255D%257D
Or here as the standalone repo: https://github.com/schmidsi/graph-client-bug-
You can go in there, install dependencies and then run the dev server:
pnpm install
pnpm graphclient build
pnpm graphclient serve-dev
And run an arbitrary query in the dev GraphiQL like:
query MyQuery {
traits {
name
numberOfNfts
}
}
To reproduce. Happend to me on CodeSandbox and isolated env on my machine.
It seems you're using an old version of GraphQL js. Could you update graphql
to the latest and try again?
Interesting, updating to "graphql": "^16.6.0",
did the trick. Thanks for the help!