graphql / vscode-graphql

MIGRATED: VSCode GraphQL extension (autocompletion, go-to definition, syntax highlighting)
https://marketplace.visualstudio.com/items?itemName=Prisma.vscode-graphql
MIT License
555 stars 71 forks source link

fix(graphql-content-provider.ts): language server fails silently when… #125

Closed ahmehri closed 5 years ago

ahmehri commented 5 years ago

… getting endpoint if it contains env variable.

This fix is related to #98 and deals with one of the reasons referred to as any other reason:

The bigger issue however is that there is no visible error when the language server fails to parse the config file (e.g. when an environment variable doesn't exist at all, or for any other reason).

The language server in the following case will fails silently. Given a .graphqlconfig file containing the following endpoints:

{
  "endpoints": {
    "default": {
      "url": "https://www.someurl.com",
      "headers": {
        "Authorization": "Bearer ${env:AUTH_TOKEN}"
      }
    }
  }
}

then when executing a query using the extension, it will result in an empty content. However, if you debug the extension, a Environment variable AUTH_TOKEN is not set error will be logged.