Skip to content

Sidebar DevTools not working in IDX/Firebase Studio #5158

Closed

Description

@pdblasi-google

Describe the bug
When opening a remote VSCode or CodeOSS Workspace, the Flutter DevTools in the sidebar fails to load. It appears to be assuming it has access to a server on localhost, which is not the case for remote workspaces.

To Reproduce
This should be reproducible in any remote workspace, but is trivial to reproduce using IDX.

Steps to reproduce the behavior:

  1. Create a new workspace in IDX
  2. Click on the Flutter extension icon in the activity bar
  3. Wait for the "Flutter Sidebar" to load with the failure shown below

Expected behavior
The Flutter Sidebar functionality should be shown for remote workspaces, or the section should not be visible if the functionality cannot be supported remotely.

Screenshots

Screenshot 2024-06-27 at 2 05 34 PM

Please complete the following information:

You can run the Dart: Collect Diagnostic Information command from the VS Code command palette (F1) to easily capture this information or provide it manually.

  • Operating System and version: N/A
  • VS Code version: Tested on Project IDX 1.83.1
  • Dart extension version: v3.90.0
  • Dart/Flutter SDK version: Flutter 3.22.2 | Dart 3.4.3 | DevTools 2.34.3
  • Target device (if the issue relates to Flutter debugging): N/A

Activity

  1. DanTup commented on Jun 28, 2024

    @DanTup
    Member

    I pushed a fix to ensure the sidebar URL is passed through exposeUrl() and it gets further, but it fails because the sidebar is trying to connect to the Dart Tooling Daemon and that URL is also unexposed:

    image

    So I made a change (d7c9150) to expose the DTD URI before we pass it to DevTools (I'm not sure this is safe yet, but I did it for testing) and it gets further - it claims it's connected to DTD, but then it fails with a WebSocket error:

    image

    Unfortunately the error is not very useful and there's nothing more useful in the Network log. I don't know if this is an IDX issue, or DevTools/DevTools server. I've reverted that change for now until I have a better idea what's wrong.

    @kenzieschmoll does (or will in future) DevTools server connected to DTD directly, or does the URI only be given to the client web app? If it needs to connect itself, then we might need to update the server to accept two URIs - one local, and one public.

    When running in a cloud IDE, there are two machines in play - the client web browser ("client") where the VS Code UI is running (and which contains webviews for things like DevTools/sidebar) and then the remote container ("server"). For everything running in the server (Dart-Code, DevTools server), DTD can be connected to on localhost.. but for the UI running in the users browser, we have to ask the cloud IDE to expose a port and give us back a URL that is tunnelled though (this might look like https://9100-idx-my-test-sidebar-app-171680.cluster-4ezwabcvdojawstf2k7vqy36oe6.cloudworkstations.dev/ which may map to localhost:9100 in the container).

    The DevTools UI needs to use the public URI to connect to any services (because they're not accessible on localhost from the users browser) but any direct connections probably need to still use localhost. So if DevTools server may use the URI for more than just feeding to the web app, we might need to give it both URIs so it can use the correct one for each use.

  2. added
    in flutter sidebarRelates to something in the "Flutter sidebar" that's provided via DevTools
    on Jun 28, 2024
  3. added this to the v3.94.0 milestone on Jun 28, 2024
  4. DanTup commented on Jun 28, 2024

    @DanTup
    Member

    @kenzieschmoll also, I thought DevTools was no longer minified so I tried changing to the master channel to see if I got a more useful stack trace, but it seemed the same on master. Did I misremember?

  5. pdblasi-google commented on Jun 28, 2024

    @pdblasi-google
    Author

    @DanTup There is a known issue in GCW where SSE connections aren't supported that has affected DevTools historically, so you may be blocked on that for a full fix.

    We had a workaround for a while using a custom fork that used WebSockets instead, but had to drop the custom fork for maintenance reasons and because we weren't sure what other effects switching to WebSockets may have had downstream.

    We've been continuing to push for SSE support from the GCW team, so the exposeUrl() fix should eventually be enough to resolve this issue if you'd rather not pursue switching from SSE connections at the moment.

  6. DanTup commented on Jul 1, 2024

    @DanTup
    Member

    I'm not sure I understand - do you mean neither WebSockets or SSE works, or should WebSockets work? (the error seems to be WebSockets, not SSE... I was sure we could use full WebSockets for all the Dart/Flutter tools because we'd had some SSE issues on other cloud platforms).

  7. pdblasi-google commented on Jul 1, 2024

    @pdblasi-google
    Author

    SSE is the protocol that's currently unsupported on GCW.

    Our workaround was that we forced the protocol for dev tools to use wss protocols. We had to drop the forked version not because of wss, but because of the maintenance costs of maintaining the fork and our changes to it.

  8. DanTup commented on Jul 1, 2024

    @DanTup
    Member

    I see. But does this mean your understanding is that WebSockets are fully supported? The error above seems to be a WebSocket error, but I don't know if it's an infrastructure issue or something else. If WebSockets should work, I'll try to do some more debugging. I do recall on some cloud IDEs many requests would go through some authentication/redirects that would often break these kinds of connections, but I don't know if that's what's happening here (I think mostly that was an issue with the Dart debug extension where requests wouldn't get the auth cookies a normal request from a browser tab would).

  9. pdblasi-google commented on Jul 1, 2024

    @pdblasi-google
    Author

    Apologies, I didn't write the original workaround, so I'm not completely familiar with why the changes that were made work. From what I can gather from the patch, these are the changes we made:

    • We updated the port specification to follow the GCW docs, where the port is specified as part of the host rather than via the port property of the URL.
      • We changed any 80- in the host to be {n.port}- instead
    • We forced dev tools to use wss, which sounds like it may not have been needed, or is an older workaround

    I'm not sure if these workarounds are still relevant, but those are the two major changes we had in place.

  10. modified the milestones: v3.94.0, v3.96.0 on Jul 22, 2024
  11. DanTup commented on Aug 27, 2024

    @DanTup
    Member

    There are likely multiple issues here. A few issues were fixed above for mapping the URI used in the iframe, however the DTD connection fails from the browser because that's not mapped.

    The next step is to make the DevTools server accept a pair of DTD URIs (an internal and external one) and provide the correct one to the front-end. Once the server supports it, Dart-Code can pass both.

    There may be some additional issues with the use of SSE, but it may be easier to validate that with the rest working. There's an existing issue at flutter/devtools#2892 that is tracking working with proxies that don't support SSE.

  12. 9 remaining items

  13. DanTup commented on Nov 25, 2024

    @DanTup
    Member

    I tested this again on latest code to see what things look like now. Both the stack trace and the error are still minified though so it's not clear what the underlying issue is. If I paste that wss: URL into my browser address bar with https, I get a 404 back which I'm not sure if is indicative of the problem (the network tab doesn't seem to give any indication of this).

    Screenshot 2024-11-25 121116
    Screenshot 2024-11-25 121130
    Screenshot 2024-11-25 121158

    @kenzieschmoll any ideas if we can get a better error message from this? I recall you saying there were some changes that would improve this, though I'm not sure if they were just stack traces or if would cover the runtime error messages anyway?

  14. modified the milestones: v3.102.0, On Deck on Nov 25, 2024
  15. kenzieschmoll commented on Nov 25, 2024

    @kenzieschmoll

    The most recent change that would have affected stack traces is flutter/devtools#8510 but this would have only affected the stack traces sent to analytics. So if you were running DevTools from tip of source, then you would have all the recent updates to improve stack traces for runtime exceptions.

    Looks like the exception is probably coming from package:web_socket_channel. @elliette any idea why we'd still be getting "Instance of minified" after your changes to show non-minified stack traces using the source maps?

  16. elliette commented on Nov 27, 2024

    @elliette

    This is the change that added the stack trace mapping to DevTools: flutter/devtools#8385

    I just checked that serving DevTools and triggering an error does show the unminified errors, so I don't think we've regressed here:
    Screenshot 2024-11-27 at 10 54 56 AM

    I also see that web_socket_channel is included in main.dart.js.map:

    "../../../../../../../.pub-cache/hosted/pub.dev/web_socket_channel-3.0.1/lib/src/exception.dart",
    "../../../../../../../.pub-cache/hosted/pub.dev/web_socket_channel-3.0.1/lib/src/channel.dart",
    

    My only guess is that perhaps this is an error that was triggered from outside the error-handling zone: https://github.com/elliette/devtools/blob/8f31a286c352465673e5f8668247efe4096d0d8d/packages/devtools_app/lib/src/framework/app_error_handling.dart#L32

    Do the VS Code side panels have a different entry point than the main DevTools entrypoint (https://github.com/flutter/devtools/blob/3e5327a02693b1405359dc5322d7f0a40151b9b7/packages/devtools_app/lib/initialization.dart#L27)? That would explain why we don't have the error handling for them.

  17. DanTup commented on Feb 12, 2025

    @DanTup
    Member

    @elliette apologies, apparently I never responded to your question above.

    Do the VS Code side panels have a different entry point than the main DevTools entrypoint

    As far as I can tell, they don't. It's a different "page" in DevTools (StandaloneScreenType.editorSidebar) but as far as I can tell, DevTools is all initialized the same, and just the page contents are different (handled via routing).

  18. modified the milestones: On Deck, v3.116.0 on Jul 5, 2025
  19. modified the milestones: v3.116.0, v3.118.0 on Jul 29, 2025
  20. modified the milestones: v3.118.0, v3.120.0 on Aug 28, 2025
  21. changed the title [-]Sidebar DevTools not working in remote space[/-] [+]Sidebar DevTools not working in IDX/Firebase Studio[/+] on Sep 10, 2025
  22. DanTup commented on Sep 10, 2025

    @DanTup
    Member

    There have been many issues here and I believe #5680 (which was in pre-release v3.119.20250909 and will be included in the next stable release) solves the remaining one. Here's a screenshot with the Sidebar, Flutter Inspector and Property Editor all loaded in Firebase Studio today (using 3.119.20250909).

    Image

    If there are still issues after this version, we should open new specific issues for them.

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

    in flutter sidebarRelates to something in the "Flutter sidebar" that's provided via DevToolsis bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions