Unable to load schema from a URL
See original GitHub issueDescribe the bug
When trying to load my schema from an external URL, I get an error coming from node-fetch
:
TypeError: Expected signal to be an instanceof AbortSignal
at new Request (/Users/tscott/Code/nerdst/node_modules/node-fetch/lib/index.js:1222:10)
at Object.deserializeRequest (/Users/tscott/Code/nerdst/node_modules/sync-fetch/shared.js:45:10)
at Socket.<anonymous> (/Users/tscott/Code/nerdst/node_modules/sync-fetch/worker.js:16:26)
at Socket.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
This happens on every URL that I throw at it
To Reproduce Steps to reproduce the behavior:
Load your schema from a URL in GraphQL config:
schema: http://localhost:8000/graphql
documents: src/**/*.gql
Expected behavior
The schema from the URL I provided should be used
Environment:
- OS: macOS v11.3, though I’ve also seen this happen in CI
@graphql-eslint/...
:"^1.1.2"
- NodeJS: v12.22.1
Additional context
I did some digging and noticed that node-fetch
is somehow wrong about its assertion that the passed-in signal is not an AbortSignal. Something strange is going on with that logic and I’m pretty sure it’s the root cause of all this, but plenty of other packages I depend on use the exact same node-fetch
version without any problems. GraphQL Code Generator, using the exact same graphql-config (.graphqlrc.yml
), can introspect the graph at this URL just fine, but as soon as I try to run ESLint, that’s when things start to break down and I get that error all over the place.
Also wanted to say how helpful this project has been. eslint-plugin-graphql
was what we were using before and honestly I just disabled it after a while because it didn’t provide any useful feedback. This plugin, on the other hand, not only fully validates our operations but also our schema, which has been very helpful in identifying unused code, formatting mistakes, and lack of documentation. Thanks for making it!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:7 (3 by maintainers)
Top GitHub Comments
Looks like this is indeed a problem with the URL Loader so I’m closing this issue and progress will continue over on the other repo. Thanks for helping to dig in!
hmm I’m a little confused here. the only time i get this error is when i’m using@graphql-tools/url-loader
withingraphql-eslint
…I made an example repo here https://github.com/tubbo/graphql-tools-example
If you runyarn start
you don’t get an error, but if you runyarn lint
then you do.My only hunch is that for some reason the request is aborted at some point during the lint run?edit: I was using
loadSchema
instead ofloadSchemaSync
.