Skip to content

fix: vite fatals on receiving HTTP4xx #7306

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

Merged
merged 5 commits into from
Apr 27, 2023
Merged

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Apr 27, 2023

This PR fixes connectivity issues between Vite and coderd WebSocket.

Changes:

  • coderd: cover parseUUID middleware with unit tests (and fix bad message)
  • coderd startup-logs: add new cross-origin pattern (localhost:8080) moved to Vite
  • vite config: add missing error handler. It's a bug in vitejs, this is a workaround.

Without these changes, Vite quits the process with:

  ➜  Local:   http://localhost:8080/
  ➜  Network: http://192.168.0.21:8080/
  vite:proxy /api/v2/workspaceagents/1/startup-logs?follow&after=0 -> ws http://localhost:3000 +0ms
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -54,
  code: 'ECONNRESET',
  syscall: 'read'
}

Node.js v18.14.2
error Command failed with exit code 1.

@mtojek mtojek self-assigned this Apr 27, 2023
@mtojek mtojek marked this pull request as ready for review April 27, 2023 13:26
@BrunoQuaresma
Copy link
Collaborator

I can't checkout to your branch locally but the changes look good!

@mtojek mtojek merged commit 77d9937 into coder:main Apr 27, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Apr 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants