theelims / ESP32-sveltekit

A simple and extensible framework for ESP32 based IoT projects with a feature-rich, beautiful, and responsive front-end build with Sveltekit, Tailwind CSS and DaisyUI. This is a project template to get you started in no time with a fully integrated build chain.
https://theelims.github.io/ESP32-sveltekit/
Other
90 stars 15 forks source link

Vite Proxy does not work: »Error: read ECONNRESET« #52

Closed Amerlander closed 2 months ago

Amerlander commented 2 months ago

I try to use the vite proxy to work on the sveltekit code. The board is available at 192.168.1.190, but the vite proxy does not seem to work:

Vite proxy config:

proxy: {
    '/rest': {
        target: 'http://192.168.1.190',
        changeOrigin: true
    },
    '/ws': {
        target: 'ws://192.168.1.190',
        changeOrigin: true,
        ws: true
    }
}

The Vite Server shows this error: image

The serial output shows, that there was a request: image

The error message seems very general to me, so I do not really have an idea where to expect the issue. Anyone had a similar issue before or an idea what I could check?

I'm using the ESP32_Relay_X8 which is equipet with an ESP32-WROOM-32E.

theelims commented 2 months ago

Have you restarted the vite dev server after you've changed the config file? I know this failure and it usually disappears with a restart: CTRL + C --> npm run dev

Amerlander commented 2 months ago

Yes, I restarted and tried different terminals (Powershell, wsl/ubuntu, vscode powerwshe;ll). The proxy in vite is applied, otherwise I would not get an error message about it.

Also, while opening the IP in the browser works fine the websocket is not working and a toast appears when opening the demo page: image

I just tried opening the proxied url in the browser (which works) and to fetch it using API Dash (which does not work): image

Seems like the board ist blocking the requests.

Amerlander commented 2 months ago

I tested different Browsers and it works in Firefox (HTTP and WS Proxy) In Edge the HTTP Proxy also works, but not the WS Proxy. In Opera it did not worked at all.

WS were also not working in Opera on the device IP without proxy.

I disabled the Browser-Default add-blockers and all add blocking extension, but that did not changed anything.

theelims commented 2 months ago

Interesting. I tested in on Firefox and Chrome and it did work on both. But glad you got it figured out.