Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: this.splice is not a function #2145

Closed
Tracked by #2441
bobhat104 opened this issue Jul 26, 2022 · 6 comments
Closed
Tracked by #2441

TypeError: this.splice is not a function #2145

bobhat104 opened this issue Jul 26, 2022 · 6 comments
Labels
🐞 bug Something isn't working

Comments

@bobhat104
Copy link

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 }

@filipncs
Copy link
Contributor

filipncs commented Aug 3, 2022

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?

@mignotju
Copy link

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!

@justindoherty
Copy link

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?

@CelsoSantos
Copy link

Also seeing this error when running the Docker image

@gmiklich
Copy link

gmiklich commented Sep 2, 2022

@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?

@theguild-bot theguild-bot mentioned this issue Apr 16, 2023
39 tasks
@TuvalSimha TuvalSimha added the 🐞 bug Something isn't working label Apr 18, 2023
@TuvalSimha
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants