Skip to content

--dtd-uri (and server-provided storage) doesn't work with "dt serve" when embedded when SSE connection is disabled #9023

Closed

Description

@DanTup

While testing in VS Code, I ran DevTools from source using the dart.customDevTools setting. In the log I can see it spawned the server with a --dtd-uri:

[10:37:14 AM] [DevTools] [Info] Spawning D:\Dev\Google\devtools\tool\bin\dt.bat with args ["serve","--machine","--allow-embedding","--dtd-uri","ws://127.0.0.1:65196/IoZPaHuLiGI="]
[10:37:14 AM] [DevTools] [Info] ..  in D:\Dev\Google\devtools
[10:37:14 AM] [DevTools] [Info] ..  with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code","FLUTTER_ROOT":"D:\\Dev\\Google\\Flutter\\Flutter main"},"envOverrides":{"LOCAL_DART_SDK":"D:\\Dev\\Google\\dart-sdk\\sdk","FLUTTER_ROOT":"D:\\Dev\\Google\\devtools\\tool\\flutter-sdk"}}
[10:37:14 AM] [DevTools] [Info]     PID: 13844

However, when I load something like the deeplinks page it doesn't know what my project roots are, and I see this in the console:

No DTD uri provided from the server during initialization.

It looks like in serve.dart this would be passed through to devtools_server/serve_local.dart in the DDS package in the SDK, so it's possible the actual issue is in the SDK, but here seemed like the right place to raise this.

Activity

  1. changed the title [-]--dtd-uri doesn't seem to work with "dt serve"[/-] [+]--dtd-uri doesn't seem to work with "dt serve" when embedded[/+] on Mar 12, 2025
  2. DanTup commented on Mar 12, 2025

    @DanTup
    ContributorAuthor

    So this is actually a result of my change yesterday to not connect SSE when embedded.

    There's code here that varies the storage based on whether there is an SSE connection:

    final connection = await DevToolsServerConnection.connect();
    if (connection != null) {
    setGlobal(Storage, server.ServerConnectionStorage());
    } else {
    setGlobal(Storage, BrowserStorage());
    }

    My guess is that this is because SSE used to be used for the storage (this was changed in #8284).

    So this condition probably needs updating to detect whether the standard server API is available (without requiring SSE). But that probably raises a question about what this code should do:

    bool get isDevToolsServerAvailable =>
    kIsWeb && storage is ServerConnectionStorage;

    Does this mean "Is there an SSE server API available?" or is there a standard HTTP API server available? Perhaps it should be split into two booleans and then each place that uses it checked to see which it really cares about?

    @kenzieschmoll LMK what you think (and whether I should revert my change for now until this is resolved).

  3. changed the title [-]--dtd-uri doesn't seem to work with "dt serve" when embedded[/-] [+]--dtd-uri (and server-provided storage) doesn't work with "dt serve" when embedded when SSE connection is disabled[/+] on Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions