flutter / flutter/devtools

DevTools fails to load through proxies that don't support SSE

Offen
#2,892 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
cross-screen P2
Vorherrschende Sprache
Dart
Sterne
1.7k
Forks
404
Ø Merge
6 T. 17 Std.
Gemergte PRs (30 T.)
18

Beschreibung

I tried to launch DevTools in a cloud editor that doesn't support SSE (its connections will just hang indefinitely) and it failed to load (just leaving a white screen after printing the version number to the console).

The network tab looks like this:

![Screenshot 2021-04-13 at 10 36 45](https://user-images.githubusercontent.com/1078012/114532476-c9115e80-9c44-11eb-9f18-3cd551bac898.png)

I can't easily confirm, but I think it will be hanging on this `await` here:

https://github.com/flutter/devtools/blob/43b2f5ea102fede6aa4776510858775acc31c6df/packages/devtools_app/lib/main.dart#L28

That `init()` call tries to use storage which will be a `ServerConnectionStorage` because `DevToolsServerConnection.connect` does not return null here:

https://github.com/flutter/devtools/blob/f38f4acde909be516b3de172405d48b6b484ea70/packages/devtools_app/lib/src/config_specific/framework_initialize/_framework_initialize_web.dart#L18-L23

It doesn't return null, because in `connect()` the call to `api/ping` works fine (it's not SSE), which then unconditionally creates an `SseClient`:

https://github.com/flutter/devtools/blob/86102bdec15a0a5fb3fb70ab98e8ff4e5e50141c/packages/devtools_app/lib/src/server_api_client.dart#L28

_If_ we want to support this, I think there are two options:

1. Support WebSockets instead of SSE for this API (DWDS already has some abstractions over SSE+WebSockets that could probably be taken)
2. Change this code to detect that SSE is not responsive and return `null` (this would effectively disable the server though, which may affect some functionality)

@devoncarew @jacob314 I don't know if this is currently worth pursuing, but thought it was worth capturing the issue somewhere perhaps to come back to.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne in packages/devtools_app/lib/main.dart beim await init()-Aufruf, verfolge dann DevToolsServerConnection.connect in _framework_initialize_web.dart und die Erstellung von SseClient in server_api_client.dart. Ermittle, wie ein Proxy ohne reaktionsfähiges SSE behandelt werden sollte, und überprüfe, dass DevTools in dieser Umgebung nicht mehr auf einem weißen Bildschirm hängen bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
dart
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
32/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.