Skip to content

"flutter attach" fails for web: "_createDevFS: (-32601) Unknown method "_createDevFS" #149258

Open

Description

@DanTup

Steps to reproduce

If I start an application from one terminal using flutter run -d windows and then in another terminal I use flutter attach --machine to attach to it, I see no errors and flutter attach correctly outputs an app.started event. This event is what VS Code/DAP use to communicate with Flutter when attaching.

Screenshot 2024-05-29 175205

If I repeat the same steps but using the Chrome device, then I see an error "_createDevFS: (-32601) Unknown method "_createDevFS" and no app.started event is emitted, instead you get an "app.stop" with an error (note: you can repro this without the --machine and you'll just see the message written to the console, but it's less obvious what the IDE is setting).

Screenshot 2024-05-29 175247

The full stack looks like:

#0      new _OutstandingRequest (package:vm_service/src/vm_service.dart:265:34)
#1      VmService._call.<anonymous closure> (package:vm_service/src/vm_service.dart:1775:25)
#2      VmService._call (package:vm_service/src/vm_service.dart:1787:8)
#3      VmService.callServiceExtension (package:vm_service/src/vm_service.dart:1733:14)
#4      FlutterVmService.createDevFS (package:flutter_tools/src/vmservice.dart:1065:20)
#5      DevFS.create (package:flutter_tools/src/devfs.dart:516:61)
#6      FlutterDevice.setupDevFS (package:flutter_tools/src/resident_runner.dart:396:19)
#7      HotRunner._initDevFS (package:flutter_tools/src/run_hot.dart:482:23)
#8      HotRunner.attach (package:flutter_tools/src/run_hot.dart:272:41)
<asynchronous suspension>
#9      AppDomain.launch.<anonymous closure> (package:flutter_tools/src/commands/daemon.dart:815:9)
<asynchronous suspension>
#10     AppDomain.launch (package:flutter_tools/src/commands/daemon.dart:813:5)
<asynchronous suspension>
#11     AttachCommand._attachToDevice (package:flutter_tools/src/commands/attach.dart:356:17)
<asynchronous suspension>
#12     AttachCommand.runCommand (package:flutter_tools/src/commands/attach.dart:265:5)

I'm not certain if using attach like this is supported, though it's how some of the integration tests work (and I'd expect behaviour to be similar between web/VM).

Expected results

Attaching to Chrome should behave the same as attaching to a VM.

Actual results

Attaching to Chrome fails with an error.

Code sample

This can be reproduced just using a simple flutter create app.

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
PS C:\Dev\Test Projects\flutter_counter> flutter doctor -v
[!] Flutter (Channel [user-branch], 3.23.0-13.0.pre.5, on Microsoft Windows [Version 10.0.22631.3593], locale en-GB)
    ! Flutter version 3.23.0-13.0.pre.5 on channel [user-branch] at C:\Dev\Google\Flutter\Flutter main
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    • Upstream repository [email protected]:DanTup/flutter.git
    • FLUTTER_GIT_URL = [email protected]:DanTup/flutter.git
    • Framework revision 76abb6467c (34 minutes ago), 2024-05-29 17:28:30 +0100
    • Engine revision 30aa720d49
    • Dart version 3.5.0 (build 3.5.0-191.0.dev)
    • DevTools version 2.36.0-dev.10
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\danny\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.7.34031.279
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2023.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)

[√] VS Code (version 1.89.1)
    • VS Code at C:\Users\danny\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.91.20240529

[√] VS Code (version 1.90.0-insider)
    • VS Code at C:\Users\danny\AppData\Local\Programs\Microsoft VS Code Insiders
    • Flutter extension version 3.89.20240501

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.3593]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 125.0.6422.112
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 125.0.2535.51

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Activity

  1. added
    in triagePresently being triaged by the triage team
    on May 30, 2024
  2. huycozy commented on May 30, 2024

    @huycozy
    Member

    I can reproduce this issue on Web app on Windows host machine. Checking this on Web on macOS host machine, I faced another issue that looks similar to #108848.

    Output log on Windows host
    PS C:\WIP\ReproduceIssues\reproduce_issue_new_2> flutter attach --machine --no-dds -d chrome --debug-uri "http://127.0.0.1:50270/y41Hgu3RvH4="
    [{"event":"daemon.connected","params":{"version":"0.6.1","pid":7268}}]
    [{"event":"app.start","params":{"appId":"e52aba5a-4841-4dca-9dc3-fbe70c9abcfb","deviceId":"chrome","directory":null,"supportsRestart":true,"launchMode":"attach","mode":"debug"}}]
    [{"event":"app.stop","params":{"appId":"e52aba5a-4841-4dca-9dc3-fbe70c9abcfb","error":"_createDevFS: (-32601) Unknown method \"_createDevFS\".","trace":"#0      new _OutstandingRequest (package:vm_service/src/vm_service.dart:265:34)\n#1      VmService._call.<anonymous closure> (package:vm_service/src/vm_service.dart:1775:25)\n#2      VmService._call (package:vm_service/src/vm_service.dart:1787:8)\n#3      VmService.callServiceExtension (package:vm_service/src/vm_service.dart:1733:14)\n#4      FlutterVmService.createDevFS (package:flutter_tools/src/vmservice.dart:1065:20)\n#5    
      DevFS.create (package:flutter_tools/src/devfs.dart:516:61)\n#6      FlutterDevice.setupDevFS (package:flutter_tools/src/resident_runner.dart:396:19)\n#7      HotRunner._initDevFS (package:flutter_tools/src/run_hot.dart:482:23)\n#8      HotRunner.attach (package:flutter_tools/src/run_hot.dart:272:41)\n<asynchronous suspension>\n#9      AppDomain.launch.<anonymous closure> (package:flutter_tools/src/commands/daemon.dart:815:9)\n<asynchronous suspension>\n#10     AppDomain.launch (package:flutter_tools/src/commands/daemon.dart:813:5)\n<asynchronous suspension>\n#11     AttachCommand._attachToDevice (package:flutter_tools/src/commands/attach.dart:356:17)\n<asynchronous suspension>\n#12     AttachCommand.runCommand (package:flutter_tools/src/commands/attach.dart:265:5)\n<asynchronous suspension>\n#13     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1396:27)\n<asynchronous suspension>\n#14     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)\n<asynchronous suspension>\n#15     CommandRunner.runCommand (package:args/command_runner.dart:212:13)\n<asynchronous suspension>\n#16     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:372:9)\n<asynchronous suspension>\n#17     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)\n<asynchronous suspension>\n#18     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:308:5)\n<asynchronous suspension>\n#19     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:130:9)\n<asynchronous suspension>\n#20     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)\n<asynchronous suspension>\n#21     main (package:flutter_tools/executable.dart:93:3)\n<asynchronous suspension>\n"}}]
    Output log on macOS host
    ➜  repro_issues flutter attach --machine --no-dds -d chrome --debug-uri "http://127.0.0.1:62875/Tk4amSXIzyY\="
    [{"event":"daemon.connected","params":{"version":"0.6.1","pid":30614}}]
    [{"event":"app.start","params":{"appId":"6ec5a84e-ad9d-460c-aebd-a7ea5be5e599","deviceId":"chrome","directory":null,"supportsRestart":true,"launchMode":"attach","mode":"debug"}}]
    [{"event":"device.added","params":{"id":"d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e","name":"iPhone","platform":"ios","emulator":false,"category":"mobile","platformType":"ios","ephemeral":true,"emulatorId":null,"sdk":"iOS 15.8 19H370","isConnected":true,"connectionInterface":"attached","capabilities":{"hotReload":true,"hotRestart":true,"screenshot":true,"fastStart":false,"flutterExit":true,"hardwareRendering":true,"startPaused":false}}}]
    Connecting to the VM Service is taking longer than expected...
    Still attempting to connect to the VM Service...
    If you do NOT see the Flutter application running, it might have crashed. The device logs (e.g. from adb or XCode)
    might have more details.
    If you do see the Flutter application running on the device, try re-running with --host-vmservice-port to use a
    specific port known to be available.
    Exception attempting to connect to the VM Service: WebSocketException: Connection to
    'http://127.0.0.1:62875/Tk4amSXIzyY/=/ws#' was not upgraded to websocket
    This was attempt #50. Will retry in 0:00:01.600000.
    Exception attempting to connect to the VM Service: WebSocketException: Connection to
    'http://127.0.0.1:62875/Tk4amSXIzyY/=/ws#' was not upgraded to websocket
    This was attempt #100. Will retry in 0:00:01.600000.
    flutter doctor -v (stable & master)
    [√] Flutter (Channel stable, 3.22.1, on Microsoft Windows [Version 10.0.19045.4412], locale en-US)
        • Flutter version 3.22.1 on channel stable at C:\WIP\flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision a14f74ff3a (6 days ago), 2024-05-22 11:08:21 -0500
        • Engine revision 55eae6864b
        • Dart version 3.4.1
        • DevTools version 2.34.3
    
    [√] Windows Version (Installed version of Windows is version 10 or higher)
    
    [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
        • Android SDK at C:\AndroidSDK
        • Platform android-34, build-tools 34.0.0
        • Java binary at: C:\Program Files\Android\Android Studio Hedgehog\jbr\bin\java
        • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.4.4)
        • Visual Studio at D:\DOWNLOADWORK\VS2022
        • Visual Studio Community 2022 version 17.4.33213.308
        • Windows 10 SDK version 10.0.19041.0
    
    [√] Android Studio (version 2022.3)
        • Android Studio at C:\Program Files\Android\Android StudioGiraffe
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
    
    [√] Android Studio (version 2023.1)
        • Android Studio at C:\Program Files\Android\Android Studio Hedgehog
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
    
    [√] VS Code (version 1.89.1)
        • VS Code at C:\Users\ADMIN\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.88.0
    
    [√] Connected device (3 available)
        • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19045.4412]
        • Chrome (web)      • chrome  • web-javascript • Google Chrome 125.0.6422.77
        • Edge (web)        • edge    • web-javascript • Microsoft Edge 124.0.2478.67
    
    [√] Network resources
        • All expected network resources are available.
    
    • No issues found!
    [!] Flutter (Channel master, 3.23.0-9.0.pre.3, on Microsoft Windows [Version 10.0.19045.4412], locale en-US)
        • Flutter version 3.23.0-9.0.pre.3 on channel master at C:\WIP\flutter_master
        ! Warning: `flutter` on your path resolves to C:\WIP\flutter\bin\flutter, which is not inside your current Flutter SDK checkout at C:\WIP\flutter_master.
          Consider adding C:\WIP\flutter_master\bin to the front of your path.
        ! Warning: `dart` on your path resolves to C:\WIP\flutter\bin\dart, which is not inside your current Flutter SDK checkout at C:\WIP\flutter_master.
          Consider adding C:\WIP\flutter_master\bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision a1a33e63b9 (in the future), 2024-05-28 03:56:25 -0400
        • Engine revision b1751088c7
        • Dart version 3.5.0 (build 3.5.0-191.0.dev)
        • DevTools version 2.36.0-dev.10
        • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
    
    [√] Windows Version (Installed version of Windows is version 10 or higher)
    
    [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
        • Android SDK at C:\AndroidSDK
        • Platform android-34, build-tools 34.0.0
        • Java binary at: C:\Program Files\Android\Android Studio Hedgehog\jbr\bin\java
        • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.4.4)
        • Visual Studio at D:\DOWNLOADWORK\VS2022
        • Visual Studio Community 2022 version 17.4.33213.308
        • Windows 10 SDK version 10.0.19041.0
    
    [√] Android Studio (version 2022.3)
        • Android Studio at C:\Program Files\Android\Android StudioGiraffe
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
    
    [√] Android Studio (version 2023.1)
        • Android Studio at C:\Program Files\Android\Android Studio Hedgehog
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
    
    [√] VS Code (version 1.89.1)
        • VS Code at C:\Users\ADMIN\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.88.0
    
    [√] Connected device (3 available)
        • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19045.4412]
        • Chrome (web)      • chrome  • web-javascript • Google Chrome 125.0.6422.77
        • Edge (web)        • edge    • web-javascript • Microsoft Edge 124.0.2478.67
    
    [√] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
  3. added
    c: crashStack traces logged to the console
    toolAffects the "flutter" command-line tool. See also t: labels.
    platform-webWeb applications specifically
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    team-webOwned by Web platform team
    platform-windowsBuilding on or for Windows specifically
    and removed
    in triagePresently being triaged by the triage team
    on May 30, 2024
  4. added
    P2Important issues not at the top of the work list
    triaged-webTriaged by Web platform team
    on May 30, 2024
  5. jason-simmons commented on Jun 7, 2024

    @jason-simmons
    Member

    I don't think flutter attach has ever been supported for web targets.

    The AttachCommand implementation is currently tied to the HotRunner used to run mobile apps.

    I tried a quick experiment of using AttachCommand with a ResidentWebRunner, but it looks like ResidentWebRunner will need further changes to support this scenario.

  6. DanTup commented on Jun 8, 2024

    @DanTup
    ContributorAuthor

    Yeah, I'm not sure if this has ever worked - I hit it while trying to debug some issues @elliette was seeing (which I believe were attaching to web, but might have been non-Flutter).

    If it's not expected to work (or may be some time before it does - I don't know the scale of the work), it could be worth detecting early and quitting with a clearer message. I suspect the number of people hitting this is probably very low though (but it's possible this wouldn't show up in the crash reports because it's not going unhandled by the tool?).

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

    P2Important issues not at the top of the work listc: crashStack traces logged to the consolefound in release: 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyplatform-windowsBuilding on or for Windows specificallyteam-webOwned by Web platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions