apollographql / apollographql/apollo-tooling

localSchemaFile doesn't work if env var is present

Open
#1,129 9 comments 7 reactions 0 assignees View on GitHub
:hammer: cli 🐞 bug
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

**Intended outcome:**

If a `localSchemaFile` is defined, it will take precedent and load schema from the file, regardless of whether or not an engine schema is found.

**Actual outcome:**

the language server tries to load the schema from engine since it found an ENGINE_API_KEY. _Even if it fails_ to load the schema, the localSchemaFile won't be taken into account

**How to reproduce the issue:**

- Configure a client project to load a schema from a local schema file
- Verify the schema loads from the local schema file
- Add a .env file with an ENGINE_API_KEY (valid or not)
- Try to use CLI features

**Versions**

VSCode 1.5.2

Contributor guide

Open the contributing guide

Research direction

Start at the language server's schema-loading path and trace how localSchemaFile and ENGINE_API_KEY are selected. Reproduce with a local schema, then add .env containing ENGINE_API_KEY and try the CLI features; done means the local schema is used even when the engine schema is unavailable.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript, vscode
Domain
cli, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.