dart-lang / dart-lang/webdev

Vite proxied `flutter run -d chrome` does not respond with RunRequest

Open
#2,425 6 comments 0 reactions 0 assignees View on GitHub
P3 package:webdev triaged waiting-for-customer-response
Dominant language
Dart
Stars
224
Forks
94
Avg merge
4d 3h
Merged PRs (30d)
2

Description

I'm proxying `flutter run -d chrome --web-port 5710` through a Vite proxy and it doesn't respond with a `RunRequest` over the dwds websocket. When flutter.js, proxied through vite to run embedded in a Svelte app, creates the connection to the WebSocket, RunRequest never gets returned from the WebScoket.

Here is the code I can manually run in the console to get a RunRequest (I copied this by going to `http:localhost:5710` and copying ConnectRequest from the Network tab):

```
const ws = new WebSocket('ws://localhost:5173/$dwdsSseHandler')
ws.send('["ConnectRequest","appId","Im4Su93feIfeEOgiTPFjmA==","instanceId","006dcb10-0d68-11ef-907d-716f5f111410","entrypointPath","main_module.bootstrap.js"]')
```

RunRequest is returned in response to the ConnectRequest through the WS proxy, so I've verified it's not the WebSocket proxy or a hostname origin issue. Do you have any ideas why this wouldn't respond with this event?

Here is the vite config:

```
import {sveltekit} from '@sveltejs/kit/vite'
import {defineConfig} from 'vite'

export default defineConfig({
server: {
proxy: {
'/dev/ui': {
rewrite: (path) => path.replace(/^\/dev\/ui\//, '/'),
target: 'http://localhost:5710',
ws: true,
},
'/$dwdsSseHandler': {
target: 'http://localhost:5710',
ws: true,
},
},
},
plugins: [sveltekit()],
})
```

Contributor guide

Open the contributing guide

Research direction

Reproduce `flutter run -d chrome --web-port 5710` with the shown Vite proxy configuration, then trace the `/$dwdsSseHandler` ConnectRequest through DWDS. Done means the proxied WebSocket receives the expected RunRequest without requiring a manually sent request.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter, vite
Domain
devtools, networking, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.