graphql / graphql/graphiql

LSP server triggers unhandled rejection when schema endpoint is unavailable

Open
#1,711 3 comments 0 reactions 0 assignees View on GitHub
bug lsp-server
Dominant language
TypeScript
Stars
16.9k
Forks
1.9k
Avg merge
22h 45m
Merged PRs (30d)
70

Description

With a config file like:

```
module.exports = {
schema: 'http://localhost:5000/browse/api'
}
```

And the graphql server not actually running, the LSP server will try to connect to the endpoint and trigger promise rejection that is not unhandled:

```
internal/process/warning.js:40 (node:8940) UnhandledPromiseRejectionWarning: FetchError: request to http://localhost:5000/browse/api failed, reason: connect ECONNREFUSED 127.0.0.1:5000
at ClientRequest. (/Users/me/github/graphiql/node_modules/node-fetch/lib/index.js:1455:11)
at ClientRequest.emit (events.js:314:20)
at Socket.socketErrorListener (_http_client.js:428:9)
at Socket.emit (events.js:314:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
```

Unhandled rejections are bad as with Node 14 those will just crash the process.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.