apollographql / apollographql/apollo-tooling

VSCode Extension: unhandled promise rejection

Open
#1,714 0 comments 5 reactions 0 assignees View on GitHub
:spiral_notepad: component - vscode
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

**Intended outcome:**
Being able to use VSCode extension with Apollo Graph Manager.

**Actual outcome:**
```
(node:15952) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined
at Object.visitor ([my-local-path]\.vscode\extensions\apollographql.vscode-apollo-1.12.1\node_modules\apollo-language-server\lib\errors\validation.js:98:96)
at Object.enter ([my-local-path]\.vscode\extensions\apollographql.vscode-apollo-1.12.1\node_modules\graphql\language\visitor.js:324:29)
at Object.enter ([my-local-path]\.vscode\extensions\apollographql.vscode-apollo-1.12.1\node_modules\graphql\language\visitor.js:375:25)
at Object.visit ([my-local-path]\.vscode\extensions\apollographql.vscode-apollo-1.12.1\node_modules\graphql\language\visitor.js:242:26)
at Object.getValidationErrors ([my-local-path]\.vscode\extensions\apollographql.vscode-apollo-1.12.1\node_modules\apollo-language-server\lib\errors\validation.js:24:15)
at Object.collectExecutableDefinitionDiagnositics ([my-local-path]\.vscode\extensions\apollographql.vscode-apollo-1.12.1\node_modules\apollo-language-server\lib\diagnostics.js:14:38)
at GraphQLClientProject.validate ([my-local-path]\.vscode\extensions\apollographql.vscode-apollo-1.12.1\node_modules\apollo-language-server\lib\project\client.js:182:65)
at [my-local-path]\.vscode\extensions\apollographql.vscode-apollo-1.12.1\node_modules\apollo-language-server\lib\workspace.js:58:46
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:89:5)
```
**How to reproduce the issue:**

1 - Upload your schema to Graph Manager
2 - Declare your `apollo.config.js`
3 - Set your `.env` file with the `ENGINE_API_KEY`
4 - Install VSCode Extension
5 - Wait and see

My apollo.config.js is like below:
```
// apollo.config.js
module.exports = {
client: {
service: 'NAME_OF_MY_SERVICE_HERE',
includes: ['./web/src/**/*.js']
}
service: {
name: 'NAME_OF_MY_SERVICE_HERE',
endpoint: {
url: 'http://localhost:8080/graphql',
headers: {
authorization:
'Bearer MY_BEARER_TOKEN_HERE'
}
}
}
};
```

**Versions**

1.12.1

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the shown apollo.config.js, ENGINE_API_KEY, Graph Manager schema, and VSCode extension. Start with apollo-language-server/lib/errors/validation.js:98 and trace callers through diagnostics.js and project/client.js; done means the extension can use Graph Manager without an unhandled promise rejection.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript, vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.