question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: this.splice is not a function

See original GitHub issue

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 }

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:6
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
justindohertycommented, Aug 22, 2022

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?

1reaction
mignotjucommented, Aug 10, 2022

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to solve the "TypeError: array.splice is not a function ...
First of all, name your variables what they are. The name array you're using, is misleading if you use it to create a...
Read more >
TypeError: splice is not a function in JavaScript | bobbyhadz
The "splice is not a function" error occurs when the splice() method is called on a value that is not an array. To...
Read more >
TypeError: this.splice is not a function (Node v16.14.0) #5526
After upgrading to Redwood 1.4.0 from 1.3.3 the following api error occurs. Should I modify the autogenerated services or GraphSQL schemas.
Read more >
Fix - splice is not a function in JavaScript - Reactgo
In this tutorial, we are going to learn about how to fix the splice is not a function error in JavaScript. When we...
Read more >
Splice returning error TypeError: val[i].splice is not a function
Splice returning error TypeError: val[i].splice is not a function · Not actually returning anything from the titleCase function, so the return ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found