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.

Unable to load schema from a URL

See original GitHub issue

Describe 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:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
tubbocommented, Jul 9, 2021

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!

3reactions
tubbocommented, Jul 9, 2021

hmm I’m a little confused here. the only time i get this error is when i’m using @graphql-tools/url-loader within graphql-eslint

I made an example repo here https://github.com/tubbo/graphql-tools-example

If you run yarn start you don’t get an error, but if you run yarn 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 of loadSchemaSync.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS Code says "unable to load schema" because it redirects to ...
VS Code throws an JSON Schema error because https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json is redirecting to ...
Read more >
All of my .json files have problems loading reference/schema ...
Here's the exact error I'm getting. Problems loading reference 'https://schemastore.azurewebsites.net/schemas/json/package.json': Unable to load ...
Read more >
Unable to drop AVRO table if schema file is missing - Apache
Unable to drop AVRO table if schema file is missing ... ('avro.schema.url'='/tmp/schema.json'); Query: create external TABLE test STORED AS AVRO LOCATION ...
Read more >
The CI Editor does not load the syntax validation schema in ...
Unable to load schema from '/gitlab-org/gitlab/-/schema/ ... Failed to execute 'fetch' on 'WorkerGlobalScope': Failed to parse URL from ...
Read more >
unable to load schema with target namespace - XML - Bytes
Do you actually have a schema in your local directory at IFX170_TDBN.xsd? If it's at an external URL, use the full url in...
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