Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Proxy can't support WebSocket and make umi crashed #12399

Closed
ZenkieBear opened this issue May 16, 2024 · 2 comments
Closed

[Bug] Proxy can't support WebSocket and make umi crashed #12399

ZenkieBear opened this issue May 16, 2024 · 2 comments

Comments

@ZenkieBear
Copy link

What happens?

When I configured the proxy with an ws option, and send the WebSocket request to devServer, the devServer crashed:

events.js:377
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:209:20)
Emitted 'error' event on Socket instance at:
    at Socket.onerror (internal/streams/readable.js:750:14)
    at Socket.emit (events.js:400:28)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  errno: -54,
  code: 'ECONNRESET',
  syscall: 'read'
}

Mini Showcase Repository(REQUIRED)

https://github.com/ZenkieBear/umi-proxy-ws-crashing

How To Reproduce

  1. Install the NPM dependencies and start the dev server.
npm i
npm start
  1. Make a WebSocket request to dev server.
  • You can use a api-tool to send the request, such like Postman. The url should be: ws://localhost:8000/ws/api/v1/test
  • Or just visit the home page: http://localhost:8000, then you will see the crashing information in the terminal.

Context

  • Umi Version: 3.5.41
  • Node Version: 14.21.3
  • Platform: macOS Sonoma 14.4.1
@ZenkieBear
Copy link
Author

If you remove the /ws proxy, everything works right.

@fz6m
Copy link
Member

fz6m commented May 18, 2024

umi 3 不维护了,建议升级到 umi 4 。

@fz6m fz6m closed this as completed May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants