Git Product home page Git Product logo

Comments (36)

brendanator avatar brendanator commented on May 28, 2024 3

Together with @nathanaelhuffman we managed to find a solution for this.

This should work if you are inside a corporate network which is using a man-in-the-middle proxy - this sounds like all the reports on this thread.

Steps to resolve:

  1. Find the proxy root certificate on your machine
  2. Add it to a certificate store if not already there - this step may be optional depending on your os
  3. Add a new global environment variable REQUESTS_CA_BUNDLE to point at the certificate path - on windows replace '' with '/'

Please let me know if this isn't working for you

We'll look to make this a configuration option in the plugins if this works for most people

from sourcery.

Syrus avatar Syrus commented on May 28, 2024 2

Why is this issue closed? Login does not work inside a corporate MITM proxy.

`~\Documents on ☁️ (us-east-1) took 2s
❯ sourcery --verify
sourcery, version 1.0.5

Verifying user config C:\Users\320159535\AppData\Roaming\sourcery\sourcery.yaml - success
Verifying server availability https://api.sourcery.ai/health - failure

  • HTTPSConnectionPool(host='api.sourcery.ai', port=443): Max retries exceeded with url: /health (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))

Verifying refactoring functionality - success
Verifying local database - success

~\Documents on ☁️ (us-east-1) took 2s
❯`

from sourcery.

Hellebore avatar Hellebore commented on May 28, 2024 1

Thanks!

I need to submit the build to Jetbrains to approve, so it'll be a few days. I'll let you know when it's ready to test.

from sourcery.

gadeberg avatar gadeberg commented on May 28, 2024 1

Hi,
I believe I have a related issue - when I paste the token VS Code shows an error:
Could not connect to server to authenticate
... also within corporate env.

from sourcery.

djjacqmin avatar djjacqmin commented on May 28, 2024 1

I have encountered the same issues as @gadeberg. I received the same error message "Could not connect to server to authenticate" inside of VSCode while working in my corporate environment.

from sourcery.

nathanaelhuffman avatar nathanaelhuffman commented on May 28, 2024 1

@brendanator I sent you an email with the details. It looks like our SSL inspection is the culprit since it's man-in-the-middling the SSL connection.

from sourcery.

brendanator avatar brendanator commented on May 28, 2024 1

Sorry about that @adamddh. I didn't include the solution.

Please follow the instructions to set up a proxy

Let me know if you have any problems

from sourcery.

Hellebore avatar Hellebore commented on May 28, 2024

Thanks for raising the issue - I'll look into getting it to work with a proxy.

from sourcery.

Hellebore avatar Hellebore commented on May 28, 2024

Have you got the proxy set up manually in Pycharm or auto-detecting?

from sourcery.

sindre-nistad avatar sindre-nistad commented on May 28, 2024

I've used both, but neither seem to work

from sourcery.

Hellebore avatar Hellebore commented on May 28, 2024

We'd like to make sure we get the fix right before releasing it, and we're not sure our local testing replicates a corporate proxy environment.

Would you be able to try out a special build of the plugin to test it? It would still be an update delivered through Pycharm, but with some extra instructions on how to install it.

from sourcery.

sindre-nistad avatar sindre-nistad commented on May 28, 2024

Sure thing!

from sourcery.

Hellebore avatar Hellebore commented on May 28, 2024

Jetbrains approved it straight away!

To install:

  1. Start Pycharm and go to File > Settings > Plugins
  2. Click the cog icon at the top right and choose 'Manage Plugin Repositories'
  3. Add this to the list: https://plugins.jetbrains.com/plugins/alpha/list
  4. The updates tab should now have Sourcery 0.3.1-dev available - click update and then restart.

We're currently supporting the manual proxy configuration. Once it's configured you'll need to restart pycharm again for Sourcery to pick it up.

Please let me know how you get on!

from sourcery.

sindre-nistad avatar sindre-nistad commented on May 28, 2024

For the automatic proxy, sorcery, seem to by pass it (it tries to connect to api.sourcery.ai), while it goes throw the proxy when using manual proxy settings.

Unfortunately, I still get an error message saying Failed to launch Sorcery service: java.util.concurrent.TimeoutException

When checking the settings, the version for Sorcery is unknown, suggesting the plugin was unable to fetch it. I'm not sure if that is a proxy issue ate "your end", or if the request is blocked / altered on "my part".

PS: The proxy at my workplace inspects TLS traffic.

from sourcery.

Hellebore avatar Hellebore commented on May 28, 2024

Is the address of your proxy http or https?

from sourcery.

sindre-nistad avatar sindre-nistad commented on May 28, 2024

http

from sourcery.

Hellebore avatar Hellebore commented on May 28, 2024

I've sent through another tweaked version - same instructions as before but it should now be 0.3.2-dev.

Would be awesome if you could give it a try and report back.

from sourcery.

Hellebore avatar Hellebore commented on May 28, 2024

Have you had a chance to try out the new version? Would love to know if it addressed the issue.

from sourcery.

sindre-nistad avatar sindre-nistad commented on May 28, 2024

I have. Unfortunately, I still get a timeout error even though my network inspection says the request to sentry.io goes through the proxy.

from sourcery.

Hellebore avatar Hellebore commented on May 28, 2024

Do you have authenticated proxies @gadeberg and @djjacqmin ?

There's an issue with VS Code extensions and authenticated proxies that we're keeping an eye on here:
microsoft/vscode#12588

Do you run other extensions that can successfully navigate through the proxy?

from sourcery.

djjacqmin avatar djjacqmin commented on May 28, 2024

Looking at my list of extensions, the only one that requires communication with the internet is Settings Sync, it works through github primarily.

I am not a full-time developer (I'm a physicist who works in a hospital and I use a lot of Python at work), but I'll try to be as helpful as possible. I do not know what you mean by having an authenticated proxy. I can tell you that I had to add my institution's root certificate to allow conda, pip and git to run on my work PC. Are you aware of a process for doing this for VS Code?

from sourcery.

nathanaelhuffman avatar nathanaelhuffman commented on May 28, 2024

I can reproduce the same issue in PyCharm using the Sourcery 0.5.0. We use SSL man-in-the-middle inspection here and proxy all of our traffic through Zscaler. What kind of information do you need to help diagnose?

from sourcery.

brendanator avatar brendanator commented on May 28, 2024

i've just added a new option to the Sourcery binary in the latest release that verifies that it can will run correctly, including whether it can contact the Sourcery api endpoint. The sourcery binary is located in the following locations:

  • PyCharm
    • 2019.3 and below
      • Windows - %HOMEPATH%\.PyCharm<version>\config\plugins\sourcery\lib\win
      • Mac - ~/Library/Application Support/PyCharm<version>/sourcery/lib/mac
      • Linux - ~/.PyCharm<version>/config/plugins/sourcery/lib/linux
    • 2020.1 and above
      • Windows - %APPDATA%\JetBrains\PyCharm<version>\plugins\sourcery\lib\win
      • Mac - ~/Library/Application Support/JetBrains/PyCharm<version>/plugins/sourcery/lib/mac
      • Linux - ~/.local/share/JetBrains/PyCharm<version>/sourcery/lib/linux
  • VSCode
    • ~/.vscode/extensions/sourcery.sourcery-<version>/binaries/sourcery-<version>-<os>

Once in that folder you can run sourcery --verify to check if it will work. You will get an connection error if you are behind a proxy.

Sourcery uses requests for it's http requests. The documentation for requests proxy support is here which can be used with the binary as follows:

  • HTTP_PROXY=<proxy_url> sourcery --verify
  • HTTPS_PROXY=<proxy_url> sourcery --verify

It would be really helpful to find out what proxy configuration makes the verify check pass for each of you or if it never works and why. If you're not comfortable publishing this information publicly you can send me an email at [email protected]

from sourcery.

fighterii avatar fighterii commented on May 28, 2024

I get the following Error on VS Code behinde corporate proxy:
Could not connect to server to authenticate: HTTPSConnectionPool(host='api.sourcery.ai', port=443): Max retries exceeded with url: /access_token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000000000E9A8088>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

I tried the following: microsoft/vscode#12588 (comment) but it doesn't work.

from sourcery.

woctezuma avatar woctezuma commented on May 28, 2024

Same issue even though I do not use a proxy.

Failed to launch Sourcery service: java.util.concurrent.TimeoutException

Everything works fine, but I am welcomed with this message every time PyCharm starts.

from sourcery.

Culberjc avatar Culberjc commented on May 28, 2024

Error from PyCharm 2020.3 behind firewall : Verifying server availability https://api.sourcery.ai/health - failure

  • HTTPSConnectionPool(host='api.sourcery.ai', port=443): Max retries exceeded with url: /health (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1091)')))

Verifying refactoring functionality - failure

  • Incorrect hash value for static hashes

from sourcery.

ken-dwyer avatar ken-dwyer commented on May 28, 2024

I am a new user wanting to try Sourcery but also getting this error:

4/26/21
5:06 PM	Failed to authenticate with Sourcery: Could not connect to server to authenticate: HTTPSConnectionPool(host='api.sourcery.ai', port=443): Max retries exceeded with url: /access_token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1091)')))

I did try the "Manage Plugin Repositories" suggestion mentioned above: #22 (comment)

from sourcery.

 avatar commented on May 28, 2024

Still getting the error
Verifying server availability https://api.sourcery.ai/health - failure
"HTTPSConnectionPool(host='api.sourcery.ai', port=443): Max retries exceeded with url: /health (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)')))"

Verifying refactoring functionality - success
Verifying local database - success

from sourcery.

Hellebore avatar Hellebore commented on May 28, 2024

With the latest release 0.9.7 Sourcery will fall back to the Free plan if it cannot contact our authentication server. This means that you can now use Sourcery from behind a corporate proxy.

from sourcery.

Culberjc avatar Culberjc commented on May 28, 2024

from sourcery.

mnbf9rca avatar mnbf9rca commented on May 28, 2024

that's a great workaround to get us going - is there also a goal to fix it so that paid plans can also be used?

from sourcery.

 avatar commented on May 28, 2024

Thanks was waiting for this since longtime tried just now it's working fine 👍👍

from sourcery.

Hellebore avatar Hellebore commented on May 28, 2024

that's a great workaround to get us going - is there also a goal to fix it so that paid plans can also be used?

Sorry missed this - yes we are planning to fix it for paid plans, but might take a bit longer...

from sourcery.

adamddh avatar adamddh commented on May 28, 2024

@brendanator I work behind a corporate proxy with the paid plan, but Sourcery is still falling back to the free plan. Was this solved in Sourcery, or is there a publicized work-around I may have missed?

from sourcery.

mainakanyi avatar mainakanyi commented on May 28, 2024

Anyone who managed to resolve this?

sourcery, version 1.0.2

Verifying config C:\Users\jkmaina\AppData\Roaming\sourcery\sourcery.yaml - success
Verifying server availability https://api.sourcery.ai/health - failure

  • HTTPSConnectionPool(host='api.sourcery.ai', port=443): Max retries exceeded with url: /health (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))

Verifying refactoring functionality - success
Verifying local database - success

from sourcery.

mainakanyi avatar mainakanyi commented on May 28, 2024

@brendanator How did you resolve this error?

from sourcery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.