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

Use IntelliJ proxy settings when running flutter/pub commands #2914

Open
Fredro opened this issue Dec 5, 2018 · 14 comments
Open

Use IntelliJ proxy settings when running flutter/pub commands #2914

Fredro opened this issue Dec 5, 2018 · 14 comments
Milestone

Comments

@Fredro
Copy link

Fredro commented Dec 5, 2018

Steps to Reproduce

Create new project, go through the setup. It tries to run "packages get", retries a lot. Close program because getting nowhere. Open studio again select project. Studio says "package get" not run, run now. I run it, and the result below

C:\src\flutter\bin\flutter.bat --no-color packages get
Running "flutter packages get" in flutter_app...                
Could not resolve URL "https://pub.dartlang.org".
pub get failed (69) -- attempting retry 1 in 1 second...

Go into Settings, and HTTP Proxy settings, automatic proxy conf is selected. Check connection is working when entering "https://pub.dartlang.org".

Version info

[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version 10.0.16299.785], locale sv-SE)
    • Flutter version 1.0.0 at C:\src\flutter
    • Framework revision 5391447fae (5 days ago), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at C:\Users\xxx\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[√] Android Studio (version 3.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 31.1.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[√] VS Code (version 1.29.1)
    • VS Code at C:\Users\xxx\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 2.21.0

[√] VS Code, 64-bit edition (version 1.26.0)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 2.21.0

[√] Connected device (1 available)
    • Pixel 3 • xxx • android-arm64 • Android 9 (API 28)

• No issues found!
@stevemessick
Copy link
Member

Thanks for the report. Can you help me understand the issue better?

Here's what I think happened. Is this correct:

  • launch Android Studio
  • create a Flutter project using no http proxy
  • creation does not succeed, repeats "packages get"
  • close and restart Android Studio
  • notice the editor has a banner instructing that "packages get" needs to run
  • click the banner button to get packages
  • see error output
  • diagnose a proxy issue
  • set the correct proxy and test that a connection to pub does work
  • problem resolved (with some difficulty)

@stevemessick stevemessick added the waiting for customer response Auto-close if no response label Dec 5, 2018
@Fredro
Copy link
Author

Fredro commented Dec 5, 2018

Hi

Nearly correct.
At point "set correct proxy and test that a connection to pub does work". I went to the proxy settings to verify that my proxy settings are correct. "Automatic proxy configuration URL" has a valid url. Then I press the "Check connection" button at the bottom and enter "https://pub.dartlang.org/" and get "success".
So it appears that android studio can use the proxy info and make the connection, but "packages get" doesn't get the same or no proxy information at all? Hence the "could not resolve".

@no-response no-response bot removed the waiting for customer response Auto-close if no response label Dec 5, 2018
@stevemessick
Copy link
Member

Thanks for the additional info. I don't have a fix yet, but to get a work-around I want to make sure you understand the architecture. The Flutter plugin runs in the IDE and uses the IDE's proxy config (which is working). The project creation is done by the Flutter SDK, which is outside the IDE. You might need to set up a proxy for the flutter tool. Admittedly, that sounds like something the plugin should be doing but apparently it is not.

@pq for additional insights.

@stevemessick stevemessick added this to the On Deck milestone Dec 5, 2018
@stevemessick
Copy link
Member

Possibly relevant info:
https://www.dartlang.org/tools/pub/troubleshoot#pub-get-fails-from-behind-a-corporate-firewall

@pq
Copy link
Contributor

pq commented Dec 5, 2018

@Fredro: to be clear, are you setting up your proxy info in preferences here?:

image

@Fredro
Copy link
Author

Fredro commented Dec 6, 2018

@pq correct

@pq pq self-assigned this Dec 6, 2018
@pq pq added the bug label Dec 6, 2018
@pq
Copy link
Contributor

pq commented Dec 10, 2018

/cc @alexander-doroshko : since this should probably get addressed in the Dart Plugin too for vanilla pub actions.

@alexander-doroshko
Copy link
Contributor

Right, currently, IDE simply starts tools from the Dart/Flutter SDK without caring about proxy configured in the IDE settings. As far as I understand, if a proxy is configured in the OS as recommended here, this will work because the IDE and therefore Flutter/Dart tools will inherit OS proxy settings.

@pq
Copy link
Contributor

pq commented Dec 10, 2018

Thanks @alexander-doroshko! What's the recommended way to launch IDEA w/ custom environment settings?

@alexander-doroshko
Copy link
Contributor

AFAIU, IDE inherits env vars from where it is started from. I mean if you have a proxy configured globally on Windows PC then IDE will be started with these env vars. I'm not sure you need to start IDE w/ custom environment settings. I haven't tested the use case myself though.

@alexander-doroshko
Copy link
Contributor

I know that the IDE uses its proxy settings when the IDE itself needs to access the internet, I mean, verify license, fetch documentation, check for updates, etc. I'm not sure IDE needs to use its proxy settings when it launches 3rd party tools like tools from the Dart/Flutter SDK. I may be wrong, but as far as I can see, IDE doesn't use proxy settings for npm or node.js tools integration.

@pq
Copy link
Contributor

pq commented Dec 10, 2018

Great thanks @alexander-doroshko!

@Fredro : maybe try setting https_proxy as suggested in the pub notes? Let us know if that works!

@pq pq removed their assignment Dec 10, 2018
@pq pq added waiting for customer response Auto-close if no response and removed bug labels Dec 10, 2018
@Fredro
Copy link
Author

Fredro commented Dec 11, 2018

@pq Yes, setting https_proxy seems to work. As said above I also thought 3rd party tools would use IDE proxy settings since they are executed from it. But if using global env vars for setting proxy for this tool is the proper way, I'll accept it and you can close the issue. Also thanks for looking into it.

@no-response no-response bot removed the waiting for customer response Auto-close if no response label Dec 11, 2018
@pq pq changed the title Proxy problems Use IntelliJ proxy settings when running flutter/pub commands Dec 11, 2018
@pq pq added the new feature label Dec 11, 2018
@pq pq modified the milestones: On Deck, Backlog Dec 11, 2018
@pq
Copy link
Contributor

pq commented Dec 11, 2018

Thanks for verifying @Fredro! I agree this isn't ideal and have turned this into a feature tracking issue. In the meantime I added a note to the known issues section of our readme w/ the work-around (#2943). Thanks again for helping us understand the issue.

Cheers!

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

No branches or pull requests

4 participants