Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Web] make it clear that -d web-server doesn't support debug protocol #94831

Open
mihalycsaba opened this issue Dec 7, 2021 · 18 comments
Open
Labels
a: debugging Debugging, breakpoints, expression evaluation P2 Important issues not at the top of the work list platform-web Web applications specifically team-web Owned by Web platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-web Triaged by Web platform team

Comments

@mihalycsaba
Copy link

mihalycsaba commented Dec 7, 2021

When connecting to code-server with the browser(over ssh) or with vs code I can't start the web server debugger
I can for build web and that works without issues.
When I connect with vs code over ssh, the debug page never stops loading and the Dart debug extension stays gray. I can open the devtools on 9100 port, so port forwarding works.

PS C:\Users\mihcs> curl 127.0.0.1:9100


StatusCode        : 200
StatusDescription : OK
Content           : <!DOCTYPE html>

                    <!--
                      Copyright 2018 The Chromium Authors. All rights reserved.
                      Use of this source code is governed by a BSD-style license that can be
                      found in the LICENSE file.
                    -->

                    <html>
                    <hea...
RawContent        : HTTP/1.1 200 OK
                    x-xss-protection: 1; mode=block
                    x-content-type-options: nosniff
                    Accept-Ranges: bytes
                    Content-Length: 5385
                    Cache-Control: max-age=900
                    Content-Type: text/html
                    Date: Tue, 07 Dec 20...
Forms             : {}
Headers           : {[x-xss-protection, 1; mode=block], [x-content-type-options, nosniff], [Accept-Ranges, bytes], [Content-Length, 5385]...}
Images            : {}
InputFields       : {}
Links             : {}
ParsedHtml        : mshtml.HTMLDocumentClass
RawContentLength  : 5385



PS C:\Users\mihcs> curl 127.0.0.1:35731
curl : 404 Not Found
Only WebSocket connections are supported.
At line:1 char:1
+ curl 127.0.0.1:35731
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
PS C:\Users\mihcs>

Steps to Reproduce

  1. it's set up on an arm64 oracle linux 8 on oracle cloud
  2. just downloaded flutter stable with fvm after downloading the dart sdk
  3. latest code-server 3.12 from github

Logs

Logs
flutter doctor -v
[✓] Flutter (Channel stable, 2.5.3, on Oracle Linux Server 8.5 5.4.17-2136.301.1.4.el8uek.aarch64, locale
    en_US.UTF-8)
    • Flutter version 2.5.3 at /opt/flutter/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (8 weeks ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✗] Flutter IDE Support (No supported IDEs installed)
    • IntelliJ - https://www.jetbrains.com/idea/
    • Android Studio - https://developer.android.com/studio/
    • VS Code - https://code.visualstudio.com/

[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.
@mihalycsaba
Copy link
Author

mihalycsaba commented Dec 8, 2021

Here is the debug log, I noticed something strange, the log says 36503 port, but vs code opened up the 36375 port and it shows the

404 Not Found Only WebSocket connections are supported.

message on that port and nothing listens on 36503. Checked it on the remote server too, same situation.

flutter run -d web-server --debug --verbose
[  +60 ms] executing: uname -m
[  +27 ms] Exit code 0 from: uname -m
[        ] aarch64
[   +4 ms] executing: [/opt/flutter/stable/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +2 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] 18116933e77adc82f80866c928266a5b4f1ed645
[        ] executing: [/opt/flutter/stable/] git tag --points-at 18116933e77adc82f80866c928266a5b4f1ed645
[  +17 ms] Exit code 0 from: git tag --points-at 18116933e77adc82f80866c928266a5b4f1ed645
[        ] 2.5.3
[   +7 ms] executing: [/opt/flutter/stable/] git rev-parse --abbrev-ref --symbolic @{u}
[   +2 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [/opt/flutter/stable/] git ls-remote --get-url origin
[   +4 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +66 ms] executing: [/opt/flutter/stable/] git rev-parse --abbrev-ref HEAD
[   +2 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +43 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +50 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +82 ms] Skipping pub get: version match.
[ +104 ms] Generating
/home/opc/Projects/excercise_timer/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[  +82 ms] Launching lib/main.dart on Web Server in debug mode...
[ +112 ms] Updating assets
[  +70 ms] Waiting for connection from debug service on Web Server...
[  +86 ms] <- reset
[   +6 ms] /opt/flutter/stable/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/opt/flutter/stable/bin/cache/artifacts/engine/linux-arm64/frontend_server.dart.snapshot --sdk-root
/opt/flutter/stable/bin/cache/flutter_web_sdk/ --incremental --target=dartdevc --debugger-module-names
--experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill
/tmp/flutter_tools.NFZLBQ/flutter_tool.MBMYDL/app.dill --libraries-spec
file:///opt/flutter/stable/bin/cache/flutter_web_sdk/libraries.json --packages
/home/opc/Projects/excercise_timer/.dart_tool/package_config.json -Ddart.vm.profile=false
-Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-root
/tmp/flutter_tools.NFZLBQ/flutter_tools.IWJGAW --filesystem-scheme org-dartlang-app --initialize-from-dill
build/b1b715402d823b7fd5c2b68d2edcb2ce.cache.dill.track.dill --platform
file:///opt/flutter/stable/bin/cache/flutter_web_sdk/kernel/flutter_ddc_sdk_sound.dill --sound-null-safety
[  +10 ms] <- compile org-dartlang-app:/web_entrypoint.dart
[+23094 ms] Waiting for connection from debug service on Web Server... (completed in 23.2s)
[        ] Synced 26.4MB.
[        ] <- accept
[   +3 ms] Caching compiled dill
[ +165 ms] lib/main.dart is being served at http://localhost:36503
[        ] The web-server device requires the Dart Debug Chrome extension for debugging. Consider using the
Chrome or Edge
           devices for an improved development workflow.
[   +5 ms] 🔥  To hot restart changes while running, press "r" or "R".
[        ] For a more detailed help message, press "h". To quit, press "q".

@mihalycsaba
Copy link
Author

Also, from vs code if I start debugging (f5) a white page pops up that never stops loading. If I start without debugging (ctrl+f5) a page pops up with the 404 websocket message.

@maheshmnj maheshmnj added the in triage Presently being triaged by the triage team label Dec 8, 2021
@maheshmnj
Copy link
Member

@mihalycsaba when you say vscode remote are you referring to vscode remote development?
If so that doesn't seem to be an issue with flutter but with the environment, you are running in.

@maheshmnj maheshmnj added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 8, 2021
@mihalycsaba
Copy link
Author

@maheshmnj yes with the remote development extension's ssh connection to code-server, tried to connect to code-server with chrome, but the web server debugging doesn't work there either.

Yeah probably my environment is the problem, I just don't know if it is the setup I did or the host's arm64 architecture. Like I said I can build the app for web, which is all I need. I feel like there is an issue with the web server on arm64.

I just wanted to try the oracle ampere a1, they give you 4 cpus for free and they're super fast. On my intel machine my biggest project sometimes takes minutes to analyze the code, in the ampere vps it's 5 seconds max.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 8, 2021
@maheshmnj
Copy link
Member

@mihalycsaba this isn't really an issue with flutter but with the environment you are running in. Probably you may try asking about configuring and running flutter in your environment on of the support channels at https://flutter.dev/community.

Closing as this issue doesn't seem to describe a bug or a feature request in flutter, if you disagree feel free to write in the comments and I will reopen it.

Thank you.

@maheshmnj maheshmnj added r: invalid Issue is closed as not valid and removed in triage Presently being triaged by the triage team labels Dec 8, 2021
@mihalycsaba
Copy link
Author

@maheshmnj I have found this #56992 it says web targets are supported on arm64, but does that mean debugging too?

@maheshmnj maheshmnj reopened this Dec 10, 2021
@maheshmnj maheshmnj added in triage Presently being triaged by the triage team and removed r: invalid Issue is closed as not valid labels Dec 10, 2021
@maheshmnj
Copy link
Member

I'm trying to use remote and local vm linux servers for development with vs code. I connect with vs code's remote extension through ssh without problems. Building the app for web works without problems.
Something isn't working with the port forwarding or the web server device. Tried it in 2 different environments (local centos 7 x86_64 vm in vmware, remote oracle linux 8 x86_64 vm on oracle cloud), same results.

When I start the debugging in vs code(f5), a new tab opens in chrome but it never loads just hangs there loading and the Dart Debug extension remains grey.

I believe this is an issue with Remote ssh which must be filed with vscode in its dedicated repository. https://github.com/microsoft/vscode-remote-release/issues , This issue looks related microsoft/vscode-remote-release#2318

@maheshmnj maheshmnj added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 10, 2021
@mihalycsaba mihalycsaba changed the title vs code remote with code-server, web server debug doesn't work vs code remote web server debugger doesn't work Dec 10, 2021
@mihalycsaba
Copy link
Author

mihalycsaba commented Dec 10, 2021

I'm trying to use remote and local vm linux servers for development with vs code. I connect with vs code's remote extension through ssh without problems. Building the app for web works without problems.
Something isn't working with the port forwarding or the web server device. Tried it in 2 different environments (local centos 7 x86_64 vm in vmware, remote oracle linux 8 x86_64 vm on oracle cloud), same results.

When I start the debugging in vs code(f5), a new tab opens in chrome but it never loads just hangs there loading and the Dart Debug extension remains grey.

I believe this is an issue with Remote ssh which must be filed with vscode in its dedicated repository. https://github.com/microsoft/vscode-remote-release/issues , This issue looks related microsoft/vscode-remote-release#2318

I don't believe it's related, in that issue they want port forwarding to work the other way too.

Meanwhile I have created a new ubuntu x86_64 vm on oracle cloud and the web server starts on ubuntu, it crashed a few times yesterday on it's own, but now it works. So I think this could be Red Hat related. Please don't close this issue yet, I want to use it a bit more on ubuntu.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 10, 2021
@mihalycsaba mihalycsaba changed the title vs code remote web server debugger doesn't work vs code remote web server debugger doesn't work on red hat derivated linux distros Dec 10, 2021
@mihalycsaba
Copy link
Author

So yeah, just when I posted the response here, it crashed again. Yesterday it crashed faster, sometimes after less than a minute. Please tell me how can I provide a more verbose log.

Launching lib/main.dart on Web Server in debug mode...
lib/main.dart:1
Waiting for connection from Dart debug extension at http://localhost:36031
The web-server device requires the Dart Debug Chrome extension for debugging. Consider using the Chrome or Edge devices for an improved development workflow.
Please click the Dart Debug extension button in the spawned browser window
This app is linked to the debug service: ws://127.0.0.1:33273/X7QR0U7Y7Rs%3D/ws
Debug service listening on ws://127.0.0.1:33273/X7QR0U7Y7Rs=/ws
💪 Running with sound null safety 💪
Connecting to VM Service at ws://127.0.0.1:33273/X7QR0U7Y7Rs=/ws
5
DOM changed detected: Re-initialize code copier
Restarted application in 2,148ms.
DOM changed detected: Re-initialize code copier
Restarted application in 1,779ms.
3
DOM changed detected: Re-initialize code copier
Restarted application in 1,620ms.
DOM changed detected: Re-initialize code copier
Application finished.
Exited (sigterm)

@maheshmnj
Copy link
Member

maheshmnj commented Dec 10, 2021

Please share complete logs by running flutter run -d web-server -v

@maheshmnj maheshmnj added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 10, 2021
@mihalycsaba
Copy link
Author

Please share complete logs by running flutter run -d web-server -v

Well, it doesn't crash with this command. But this way hot reload doesn't work with ctrl+s. Also I don't have to click the dart debug extension for the page to load.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 10, 2021
@mihalycsaba
Copy link
Author

Tried it in an ubuntu ampere a1 (arm64), crashes there too within a minute, if I start it with f5

@maheshmnj
Copy link
Member

maheshmnj commented Dec 13, 2021

Well, it doesn't crash with this command. But this way hot reload doesn't work with ctrl+s. Also I don't have to click the dart debug extension for the page to load.

Running the above command you should be able to hot restart from the terminal by pressing r.

I am not sure if flutter can do anything about it leaving this issue open for further investigation from the team.

cc: @yjbanov

@maheshmnj maheshmnj changed the title vs code remote web server debugger doesn't work on red hat derivated linux distros [Web] VS Code remote web server debugger doesn't work on red hat derivated linux distros Dec 13, 2021
@maheshmnj maheshmnj added passed first triage platform-web Web applications specifically tool Affects the "flutter" command-line tool. See also t: labels. a: debugging Debugging, breakpoints, expression evaluation and removed in triage Presently being triaged by the triage team labels Dec 13, 2021
@yjbanov
Copy link
Contributor

yjbanov commented Dec 16, 2021

The -d web-server option is meant for a plain browser-server mode with not extra debugging capabilities. There's no guarantee that it will be possible to debug through VSCode. We should probably make attempts to connect to the debug protocol fail more proactively and with better error messages. You can debug in this mode using the browser's devtools and sourcemaps.

Let's repurpose this issue to make it more clear that -d web-server doesn't support the debug protocol, only -d BROWSER does, where BROWSER is chrome or edge.

@yjbanov yjbanov changed the title [Web] VS Code remote web server debugger doesn't work on red hat derivated linux distros [Web] make it clear that -d web-server doesn't support debug protocol Dec 16, 2021
@yjbanov yjbanov added the P2 Important issues not at the top of the work list label Dec 16, 2021
@golane-august
Copy link

@yjbanov How we are supposed to run Web tests and get the logs e.g. in Github Actions with in HEADLESS browser mode, if web-server does not support debugging? Thanks ;D

@rmschindler
Copy link

Hi Yegor (@yjbanov), where do you propose we “make it more clear that -d web-server doesn’t support the debug protocol?”—i.e. could you (or anyone) remind us where the -d web-server command line option is even documented?

@maks
Copy link

maks commented Oct 6, 2022

@rmschindler and @yjbanov my suggestion would be to document this in https://docs.flutter.dev/testing/debugging as I think Flutter webapp debugging is quite different from debugging mobile and desktop Flutter apps and definitely has its own quirks in regards to only Chrome & Edge being supported as debug targets and issues like this where the d web-server flag can be used to run a debug build and yet not allow for using an external debugger to connect to the running Flutter app.

@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-web Owned by Web platform team triaged-web Triaged by Web platform team labels Jul 8, 2023
@ascorbic-acid
Copy link

the help of "flutter run -h" was not clear for the following:

flutter run -d web-server --web-port 8090

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: debugging Debugging, breakpoints, expression evaluation P2 Important issues not at the top of the work list platform-web Web applications specifically team-web Owned by Web platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-web Triaged by Web platform team
Projects
None yet
Development

No branches or pull requests

8 participants