Skip to content

serve crashes on websocket close #11156

@epelc

Description

@epelc

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Area

- [x] devkit
- [ ] schematics

Versions

npm 6.1.0

Angular CLI: 6.0.7
Node: 10.3.0
OS: darwin x64
Angular: 6.0.3

Repro steps

Run the cli serve command with proxying to a backend websocket server(turn "ws":true on for one of your endpoints) and return an error from the websocket server. The cli proxy server will crash with the error below.

Specifically if you return an http error status code before the websocket request is upgraded to the websocket protocol. Here is the server returning the error code(it's in golang) but you can roughly see that in this example the error returned is well before the protocol change so it is just a regular http 403 error.

The log given by the failure

ℹ 「wdm」: Compiled successfully.
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TCP.onread (net.js:657:25)
Emitted 'error' event at:
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1

Desired functionality

The cli proxy dev server should support returning websocket errors to the client instead of crashing.

Mention any other details that might be useful

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions