vscode-eslint: Cannot load graphql schemas from URL - Error: Error while loading schema: Command failed

I’ve recently added @graphql-eslint/eslint-plugin to our projects. It works perfectly fine on my server app.

However on my react app side of things, I use the URL to the graphql schema in the parserOptions as described by the vendor of the plugin here: https://github.com/B2o5T/graphql-eslint

"overrides": [
    {
      "files": ["**/*.ts", "**/*.tsx"],
      "rules": {
        "react/prop-types": "error"
      }
    },
    {
      "files": ["*.graphql"],
      "parserOptions": {
        "schema": "https://staging.*********.***/gql",
        "operations": "src/graphql/operations/**/*.graphql"
      }
    }
  ]

The error I’m getting is this:

[Info  - 8:00:38 AM] ESLint server is starting
[Info  - 8:00:38 AM] ESLint server running in node v16.13.0
[Info  - 8:00:38 AM] ESLint server is running.
[Info  - 8:00:39 AM] ESLint library loaded from: ....../node_modules/eslint/lib/api.js
[Error - 8:00:40 AM] ESLint stack trace:
[Error - 8:00:40 AM] Error: Error while loading schema: Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper ....../node_modules/sync-fetch/worker.js
Occurred while linting ....../src/graphql/fragments/highlights.graphql:1
    at checkExecSyncError (node:child_process:846:11)
    at execFileSync (node:child_process:884:15)
    at func (node:electron/js2c/asar_bundle:5:1812)
    at sendMessage (....../node_modules/sync-fetch/index.js:41:10)
    at fetch (....../node_modules/sync-fetch/index.js:32:31)
    at defaultSyncFetch (....../node_modules/@graphql-tools/url-loader/index.js:51:12)
    at ....../node_modules/@graphql-tools/url-loader/index.js:492:36
    at new ValueOrPromise (....../node_modules/value-or-promise/build/main/ValueOrPromise.js:14:21)
    at executor (....../node_modules/@graphql-tools/url-loader/index.js:460:20)
    at ....../node_modules/@graphql-tools/url-loader/index.js:759:35

I’ve tried debugging it locally to understand better for no results though. I’ve asked for help on the eslint support chat and they directed me here saying that the vscode extension is quite a mess. Please help me fix it, this would tremendously benefit my development team.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 19 (10 by maintainers)

Most upvoted comments

@justlevine npm run codegen failed for me in the following way:

image

You can invite me to the repository.

@chendoron Hi, I’m curious if you resolved this issue? At the moment, I’m also trying to use @graphql-eslint/eslint-plugin but it works strange

We never got it working on vscode.