apollographql / apollographql/apollo-tooling

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined

Open
#2,168 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

My apollo.config.js is:
```
module.exports = {
client: {
service: {
name: 'pelas-graphQL',
url: 'http://api.pelas.co/graphql',
},
},
};
```
I get this error in my vscode log.
```
(node:10372) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined
at Object.visitor (c:\Users\Masih-Jahangiri\.vscode\extensions\apollographql.vscode-apollo-1.17.0\node_modules\apollo-language-server\lib\errors\validation.js:102:96)
at Object.enter (c:\Users\Masih-Jahangiri\.vscode\extensions\apollographql.vscode-apollo-1.17.0\node_modules\graphql\language\visitor.js:323:29)
at Object.enter (c:\Users\Masih-Jahangiri\.vscode\extensions\apollographql.vscode-apollo-1.17.0\node_modules\graphql\utilities\TypeInfo.js:370:25)
at Object.visit (c:\Users\Masih-Jahangiri\.vscode\extensions\apollographql.vscode-apollo-1.17.0\node_modules\graphql\language\visitor.js:243:26)
at Object.getValidationErrors (c:\Users\Masih-Jahangiri\.vscode\extensions\apollographql.vscode-apollo-1.17.0\node_modules\apollo-language-server\lib\errors\validation.js:26:15)
at Object.collectExecutableDefinitionDiagnositics (c:\Users\Masih-Jahangiri\.vscode\extensions\apollographql.vscode-apollo-1.17.0\node_modules\apollo-language-server\lib\diagnostics.js:14:38)
at GraphQLClientProject.validate (c:\Users\Masih-Jahangiri\.vscode\extensions\apollographql.vscode-apollo-1.17.0\node_modules\apollo-language-server\lib\project\client.js:182:65)
at c:\Users\Masih-Jahangiri\.vscode\extensions\apollographql.vscode-apollo-1.17.0\node_modules\apollo-language-server\lib\workspace.js:58:46
at processTicksAndRejections (internal/process/task_queues.js:94:5)
(node:10372) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:10372) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
```
**Versions**
Apollo GraphQL vscode plugin: v1.17.0

VScode:
Version: 1.51.1 (user setup)
Commit: e5a624b788d92b8d34d1392e4c4d9789406efe8f
Date: 2020-11-10T23:34:32.027Z
Electron: 9.3.3
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.18363

Contributor guide

Open the contributing guide

Research direction

Start at apollo-language-server/lib/errors/validation.js:102, then trace the callers in diagnostics.js, project/client.js, and workspace.js shown in the stack trace. Reproduce the warning with the supplied apollo.config.js and Apollo VSCode plugin version; done means the configuration no longer produces an unhandled rejection.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.