Repository navigation
"flutter attach" fails for web: "_createDevFS: (-32601) Unknown method "_createDevFS" #149258
Description
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.
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).
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
huycozy commentedon May 30, 2024
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
Output log on macOS host
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!jason-simmons commentedon Jun 7, 2024
I don't think
flutter attachhas ever been supported for web targets.The
AttachCommandimplementation is currently tied to theHotRunnerused to run mobile apps.I tried a quick experiment of using
AttachCommandwith aResidentWebRunner, but it looks likeResidentWebRunnerwill need further changes to support this scenario.DanTup commentedon Jun 8, 2024
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?).
[flutter_tools/dap] Handle app.stop errors when launching/attaching (#…