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

Vite won't restart if proxy is interrupted #8117

Closed
7 tasks done
wenq1 opened this issue May 11, 2022 · 2 comments
Closed
7 tasks done

Vite won't restart if proxy is interrupted #8117

wenq1 opened this issue May 11, 2022 · 2 comments

Comments

@wenq1
Copy link

wenq1 commented May 11, 2022

Describe the bug

If configured with proxy, such as

server.proxy: {
    '/api':         {target: 'http://localhost:3000/'},
}

Vite won't restart when the local server is restarted, especially when server restart takes more than a few seconds (during development), throwing an error:

19:25:21 [vite] http proxy error:
Error: connect ECONNREFUSED 127.0.0.1:3000
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16)

Reproduction

n/a

System Info

System:
    OS: macOS 12.2
    CPU: (8) x64 Apple M1
    Memory: 47.80 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.2 - /usr/local/opt/node@16/bin/node
    Yarn: 1.22.18 - /usr/local/bin/yarn
    npm: 8.5.0 - /usr/local/opt/node@16/bin/npm
  Browsers:
    Chrome: 101.0.4951.54
    Safari: 15.3
  npmPackages:
    @vitejs/plugin-react: ^1.1.4 => 1.2.0 
    @vitejs/plugin-react-refresh: ^1.3.6 => 1.3.6 
    vite: ^2.7.12 => 2.8.6

Used Package Manager

npm

Logs

No response

Validations

@PawanAP30
Copy link

I keep getting this error and can't fix it. Any solutions??

@NullEnt1ty
Copy link

I'm not sure when it happened, but apparently this is fixed now. I upgraded from Vite 2.x to 4.2.1 and it works like a charm now. I'm still getting error messages from Vite when I'm restarting the proxy target server (which is fine I guess), but once the target server is ready Vite will connect to the server again.

@Niputi Niputi closed this as completed Mar 30, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Apr 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants