TypeError: this.splice is not a function
See original GitHub issueAttempting 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 }
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:5 (1 by maintainers)
Top GitHub Comments
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 ofcross-undici-fetch
instead of the newer@whatwg-node/fetch
package found in the newer@graphql-yoga/node
package. Any reason it’s pinned at2.0.0
specifically?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!