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

Error when server restart within middleware mode #12707

Closed
7 tasks done
rainbowatcher opened this issue Apr 3, 2023 · 0 comments · Fixed by #12734
Closed
7 tasks done

Error when server restart within middleware mode #12707

rainbowatcher opened this issue Apr 3, 2023 · 0 comments · Fixed by #12734
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release

Comments

@rainbowatcher
Copy link

rainbowatcher commented Apr 3, 2023

Describe the bug

I'm using the middleware mode of Vite, and upon updating vite.config.js, the development server commenced restarting. After it launch, the browser console began throwing errors,
image

while in Vite's logs there was also a message of the port being occupied.
image

When I switched to vite@4.1.4, this issue was not present.

the port error is raise on packages/vite/src/node/server/index.ts:840
when the server.close() called.
related PR: #12379

Reproduction

https://github.com/rainbowatcher/vite-middleware-mode-error-eproduction.git

Steps to reproduce

  1. Clone the reproduction repo via git clone https://github.com/rainbowatcher/vite-middleware-mode-error-eproduction.git
  2. Install dependencies via pnpm i
  3. Start the server via node src/server/server.js
  4. Open the server page in browser
  5. Change the vite.config.js and save, then wait the dev server restart.

System Info

System:
  OS: macOS 13.3
  CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
  Memory: 276.07 MB / 16.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 18.15.0 - ~/Library/Caches/fnm_multishells/81355_1680497113342/bin/node
  Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/81355_1680497113342/bin/yarn
  npm: 9.5.0 - ~/Library/Caches/fnm_multishells/81355_1680497113342/bin/npm
Browsers:
  Safari: 16.4
npmPackages:
  @vitejs/plugin-vue: ^4.1.0 => 4.1.0 
  vite: ^4.2.1 => 4.2.1

Used Package Manager

pnpm

Logs

No response

Validations

@sapphi-red sapphi-red added p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release labels Apr 3, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants