Skip to content

Inspector throwing error when connecting to flutter web app #3068

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

Closed
kenzieschmoll opened this issue May 27, 2021 · 5 comments
Closed

Inspector throwing error when connecting to flutter web app #3068

kenzieschmoll opened this issue May 27, 2021 · 5 comments

Comments

@kenzieschmoll
Copy link
Member

kenzieschmoll commented May 27, 2021

repro steps:

  • run flutter gallery as a web app
  • connect to DevTools

@grouma @jacob314
There are some dwds frames on the call stack - not sure if that is the cause, but worth noting.

[ERROR:flutter/lib/ui/ui_dart_state.cc(213)] Unhandled Exception: getObject: (-32603) getObject: Unexpected error from chrome devtools:
text: Uncaught
exception:
  description: null
  type: string
  value: cannot find library for package:gallery/demos/material/material_demos.dart
attempted JS eval: `    (function() {
         var sdkUtils = require('dart_sdk').dart;
   var library = sdkUtils.getLibrary('package:gallery/demos/material/material_demos.dart');
   if (!library) throw 'cannot find library for package:gallery/demos/material/material_demos.dart';

      var result = {};
      var classes = Object.values(Object.getOwnPropertyDescriptors(library))
        .filter((p) => 'value' in p)
        .map((p) => p.value)
        .filter((l) => l && sdkUtils.isType(l));
      var classList = classes.map(function(clazz) {
        var descriptor = {
          'name': clazz.name,
          'dartName': sdkUtils.typeName(clazz)
        };
        return descriptor;
      });
      result['classes'] = classList;
      return result;
    })()
    `

#0      handleErrorIfPresent (package:dwds/src/utilities/shared.dart:56:5)
#1      LibraryHelper._constructLibrary (package:dwds/src/debugging/libraries.dart:94:5)
<asynchronous suspension>
#2      LibraryHelper.libraryFor (package:dwds/src/debugging/libraries.dart:59:44)
<asynchronous suspension>
#3      AppInspector.getObject (package:dwds/src/debugging/inspector.dart:330:21)
<asynchronous suspension>
#4      VmServerConnection._delegateRequest (package:vm_service/src/vm_service.dart:1378:22)
<asynchronous suspension>

#0      new _OutstandingRequest (package:vm_service/src/vm_service.dart:1606:45)
#1      VmService._call (package:vm_service/src/vm_service.dart:2078:21)
#2      VmService.getObject (package:vm_service/src/vm_service.dart:1868:7)
#3      VmServiceWrapper.getObject (package:devtools_app/src/vm_service_wrapper.dart:396:48)
#4      InspectorService._updateLocalClasses (package:devtools_app/src/inspector/inspector_service.dart:272:16)
<asynchronous suspension>
#5      InspectorService._onRootDirectoriesChanged (package:devtools_app/src/inspector/inspector_service.dart:262:5)
<asynchronous suspension>
#6      InspectorService.inferPubRootDirectoryIfNeeded (package:devtools_app/src/inspector/inspector_service.dart:327:5)
<asynchronous suspension>
#7      InspectorController.maybeLoadUI (package:devtools_app/src/inspector/inspector_controller.dart:391:26)
<asynchronous suspension>
#8      InspectorController.maybeLoadUI (package:devtools_app/src/inspector/inspector_controller.dart:405:9)
<asynchronous suspension>

@grouma
Copy link
Member

grouma commented May 27, 2021

@annagrin @nshahan ideas on why we wouldn't be able to find the library?

@nshahan
Copy link

nshahan commented May 27, 2021

My only guess would be that the getLibrary() call is happening before the module that contains the library has been evaluated. Did something change that could have caused this call to happen earlier than it was before? Is the app fully loaded when this happens?

@annagrin
Copy link
Contributor

annagrin commented May 27, 2021

I tried to repro but did not encounter the issue - @kenzieschmoll could you please clarify the steps?

I did the following:

  • flutter run -d chrome --debug in flutter/gallery (synced to the latest master)
  • pub global activate devtools
  • pub global run devtools
  • copied and pasted vm service uri to devtools
  • refreshed the tree in the layout explorer, clicked on a few components on the tree

Everything seems fine so far... Let me know if i missed anything.

I am running the following versions:
DevTools version 2.2.4
➜ hello_world git:(master) flutter doctor -v
[✓] Flutter (Channel master, 2.3.0-13.0.pre.200, on Mac OS X 10.15.7 19H1030
darwin-x64, locale en-US)
• Flutter version 2.3.0-13.0.pre.200 at
/Users/annagrin/source/flutter/flutter
• Upstream repository [email protected]:annagrin/flutter.git
• Framework revision 7253538a52 (32 minutes ago), 2021-05-27 17:49:05 -0400
• Engine revision a962fb3b82
• Dart version 2.14.0 (build 2.14.0-153.0.dev)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
✗ cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for
more details.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.1

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build
1.8.0_212-release-1586-b4-5784211)

[✓] IntelliJ IDEA Community Edition (version 2021.1)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 55.1.5
• Dart plugin version 211.6693.108

[✓] VS Code (version 1.56.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.22.0

[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.7 19H1030
darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.77

@jacob314
Copy link
Contributor

I hit this issue yesterday and filed. separate bug. Closing as there is now a workaround and the libs that crash are no-ops..

@starball5
Copy link

@jacob314 what's the workaround? And what's the other issue ticket that you raised?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants