question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Always show Starting DevTools

See original GitHub issue

Thanks for the feedback! If your issue is related to the Flutter framework itself, please open an issue at github.com/flutter/flutter.

Steps to Reproduce

image

I am using flutter in China, and I must access dart pub through http proxy, but the flutter intellij plugin does not support the use of idea proxy settings. When I start android-studio by adding the http_proxy environment variable, flutter_intellij uses the proxy correctly, but I cannot debug and run the flutter app.

Use Http Proxy
set http_proxy=http://127.0.0.1:7890 & set https_proxy=http://127.0.0.1:7890
"C:\Program Files\Android\Android Studio\bin\studio64.exe"

Starting DevTools will load normally, but:

[        ] Waiting for observatory port to be available...
[+3036 ms] Observatory URL on device: http://127.0.0.1:37729/Emoi_L7U-s8=/
[        ] executing: C:\Users\me\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 forward tcp:0 tcp:37729
[  +40 ms] 11498
[        ] Forwarded host port 11498 to device port 37729 for Observatory
[   +4 ms] Caching compiled dill
[  +41 ms] Connecting to service protocol: http://127.0.0.1:11498/Emoi_L7U-s8=/
[ +206 ms] Exception attempting to connect to the VM Service: WebSocketException: Connection to 'http://127.0.0.1:11498/Emoi_L7U-s8=/ws#' was not upgraded to websocket
[        ] This was attempt #1. Will retry in 0:00:00.100000.
[  +12 ms] E/DartVM  (30122): vm-service: Error: Unhandled exception:
[        ] E/DartVM  (30122): WebSocketException: Invalid WebSocket upgrade request
[        ] E/DartVM  (30122): 
[        ] E/flutter (30122): [ERROR:flutter/runtime/dart_isolate.cc(1137)] Unhandled exception:
[        ] E/flutter (30122): WebSocketException: Invalid WebSocket upgrade request
[ +109 ms] Fail to connect to service protocol: http://127.0.0.1:11498/Emoi_L7U-s8=/: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:11498/Emoi_L7U-s8=/ws
Activating Dart DevTools...
[{"event":"app.progress","params":{"appId":"14233403-292e-4903-8e05-627f62656f86","id":"2","progressId":null,"message":"Activating Dart DevTools...","finished":false}}]
[{"event":"app.progress","params":{"appId":"14233403-292e-4903-8e05-627f62656f86","id":"2","progressId":null,"finished":true}}]
[+9085 ms] Error connecting to the service protocol: failed to connect to http://127.0.0.1:11498/Emoi_L7U-s8=/

If use http_proxy environment variable,flutter run will Will be damaged.

I think the best solution

flutter-intellij should read the proxy settings of the idea and attach it to the runtime environment when executing any flutter pub.

image

If execute flutter run, should not use a proxy.

image

Version info

flutter-intellij: 53.0.1 flutter:

[√] Flutter (Channel master, 1.26.0-18.0.pre.90, on Microsoft Windows [Version 10.0.19042.746], locale zh-CN)
    • Flutter version 1.26.0-18.0.pre.90 at C:\Users\me\AppData\Local\Android\flutter
    • Framework revision 25134a16d1 (3 days ago), 2021-01-29 23:52:30 -0800
    • Engine revision ce14c8a841
    • Dart version 2.12.0 (build 2.12.0-276.0.dev)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\me\AppData\Local\Android\Sdk
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = C:\Users\me\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

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

[√] Android Studio (version 4.1.0)
    • 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 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.52.1)
    • VS Code at C:\Users\me\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[!] Proxy Configuration
    • HTTP_PROXY is set
    ! NO_PROXY is not set

[√] Connected device (3 available)
    • sdk gphone x86 64 arm64 (mobile) • emulator-5554 • android-x64    • Android 11 (API 30) (emulator)
    • Chrome (web)                     • chrome        • web-javascript • Google Chrome 88.0.4324.104
    • Edge (web)                       • edge          • web-javascript • Microsoft Edge 88.0.705.53

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:28 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
xkeyCcommented, Feb 10, 2021

@xkeyC interesting, so the pub mirror site does not only provide the DevTools package, it also compiles the local version of flutter you are running?

I’m going to close this issue since we’re not going to be making changes to the plugin to accommodate this case (although we are looking into app startup changes so it will not hang on DevTools starting). I recommend potentially posting to flutter/flutter with suggestions on how HTTP_PROXY or PUB_HOSTED_URL could be changed for this case; someone there may also have better recommendations for workarounds.

Okay,I think I can use my own method to solve this problem: https://github.com/clinux-co/proxy2pub . It can convert general Http_Proxy into FLUTTER_STORAGE_BASE_URL and PUB_HOSTED_URL. @helin24 @UbuntuLover

image image

2reactions
tehprofessorcommented, Feb 2, 2021

I was getting this too and I don’t use a proxy.

It looks like it was caused by the issue linked in #5230

To fix it, I needed to:

  1. flutter channel dev
  2. Download a previous version of this pacakge: https://plugins.jetbrains.com/files/9212/107560/flutter-intellij.zip?updateId=107560&pluginId=9212&family=INTELLIJ
  3. Install the package by going to Extensions and select Install from Disk
  4. Activate the old version of devtools: flutter pub global activate devtools 0.9.6+3
  5. In intellij go to File > Invalidate Caches and Restart

Another symptom I encountered was the autocomplete not working anymore. It wasn’t until step 5 above that the autocomplete finally started working.

Hope that helps you. I was losing my freakin’ mind over this…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatically open Chrome DevTools in each new tab
Tip: You can automatically open Chrome DevTools in each new tab! Just pass the --auto-open-devtools-for-tabs flag to Chrome.
Read more >
Developer Tools Console opens by itself randomly. How do I ...
Go to chrome://serviceworker-internals/?devtools and uncheck the "Open DevTools window and pause JavaScript execution on Service Worker startup for debugging" ...
Read more >
Open Chrome DevTools
All of the ways that you can open Chrome DevTools. ... This mode shows you helpful tooltips when you hover over elements on...
Read more >
Install and run DevTools from Android Studio | Flutter
Launch DevTools from an action ... You can also open DevTools from an IntelliJ action. Open the Find Action… dialog (on a Mac,...
Read more >
1569859 - Auto-open devtools for newly opened tabs/windows
Chrome has a feature like this. There is a setting for the Chrome DevTools called "Auto-open DevTools for popups". If it is enabled,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found