graphql-inspector
graphql-inspector copied to clipboard
TypeError: this.splice is not a function
Attempting to run graphql-inspector serve SCHEMA version 3.1.1 or above results in an error message:
` success GraphQL API: http://localhost:4000 C:\Users\bobhat\AppData\Roaming\npm\node_modules@graphql-inspector\cli\node_modules\cross-undici-fetch\dist\patch-headers-list.js:44 this.splice(index, 0, normalizedName, normalizedValue) ^
TypeError: this.splice is not a function at HeadersList.append (C:\Users\bobhat\AppData\Roaming\npm\node_modules@graphql-inspector\cli\node_modules\cross-undici-fetch\dist\patch-headers-list.js:44:16) at Headers.append (C:\Users\bobhat\AppData\Roaming\npm\node_modules@graphql-inspector\cli\node_modules\undici\lib\fetch\headers.js:196:31) at fill (C:\Users\bobhat\AppData\Roaming\npm\node_modules@graphql-inspector\cli\node_modules\undici\lib\fetch\headers.js:69:15) at new Headers (C:\Users\bobhat\AppData\Roaming\npm\node_modules@graphql-inspector\cli\node_modules\undici\lib\fetch\headers.js:170:5) at new Request (C:\Users\bobhat\AppData\Roaming\npm\node_modules@graphql-inspector\cli\node_modules\cross-undici-fetch\dist\node-ponyfill.js:77:29) at getNodeRequest (C:\Users\bobhat\AppData\Roaming\npm\node_modules@graphql-inspector\cli\node_modules@graphql-yoga\node\index.js:40:16) at YogaNodeServer.handleIncomingMessage (C:\Users\bobhat\AppData\Roaming\npm\node_modules@graphql-inspector\cli\node_modules@graphql-yoga\node\index.js:150:31) at Server.YogaNodeServer.requestListener (C:\Users\bobhat\AppData\Roaming\npm\node_modules@graphql-inspector\cli\node_modules@graphql-yoga\node\index.js:127:41) at Server.emit (node:events:527:28) at parserOnIncoming (node:_http_server:956:12) `
If I revert back to graphql-inspector/cli version 3.1.0 or earlier, it works fine without a problem. This seems to be caused by a library upgrade since 3.1.0. Any idea how to fix this?
Here is my example schema.graphql
type Query { test: String }
I can't reproduce this, but it looks like an issue with a part of a polyfill for the fetch api.
What version of node are you on, and would it be possible for you to try to reproduce with a more recent version?
Hello,
I am having the same issue using graphql-inspector validate command, with node version: v16.16.0 (LTS)
I don't have the issue with node v18.7.0.
Would it be possible to have it working for node LTS version ?
I can provide more information if needed.
Thanks a lot!
It seems to me it has to do with the pinned 2.0.0 version of @graphql-yoga/node as part of the serve command which is requiring the old version of cross-undici-fetch instead of the newer @whatwg-node/fetch package found in the newer @graphql-yoga/node package. Any reason it's pinned at 2.0.0 specifically?
Also seeing this error when running the Docker image
@justindoherty came to the same conclusion that I did. I currently have to choose between an insecure version of undici or broken functionality because of the pinned yoga-node version. Can we update this please?
Hey all :)
You are more than welcome to update the @graphql-inspector/cli package to version 3.4.16. We updated the yoga version. I tested it on node 14 / 16 / 18 and all was great!
Please feel free to update me on any new weird behavior.