scalameta / metals-vscode

Visual Studio Code extension for Metals
https://marketplace.visualstudio.com/items?itemName=scalameta.metals#overview
Apache License 2.0
298 stars 75 forks source link

vscode metals not updating as download fails with ssl errors #1430

Closed fwaris closed 10 months ago

fwaris commented 11 months ago

Describe the bug metals not updating due ssl certificate issues

Screenshots

Java home: C:\Program Files\Microsoft\jdk-17.0.8.101-hotspot\ Metals version: 1.0.1 Downloading https://repo1.maven.org/maven2/org/scalameta/metals_2.13/1.0.1/metals_2.13-1.0.1.pom [...] Downloading https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/metals_2.13/1.0.1/metals_2.13-1.0.1.pom.sha1 Resolution error: Error downloading org.scalameta:metals_2.13:1.0.1 not found: C:\Users\fwaris1.ivy2\local\org.scalameta\metals_2.13\1.0.1\ivys\ivy.xml download error: Caught javax.net.ssl.SSLHandshakeException (PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target) while downloading https://repo1.maven.org/maven2/org/scalameta/metals_2.13/1.0.1/metals_2.13-1.0.1.pom download error: Caught javax.net.ssl.SSLHandshakeException (PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target) while downloading https://dl.bintray.com/scalacenter/releases/org/scalameta/metals_2.13/1.0.1/metals_2.13-1.0.1.pom

Installation:

Additional context

I have update java version to latest

tgodzik commented 11 months ago

Thanks for reporting! To sure what might exactly be wrong, but you could try adding -noverify to metals.serverProperties as a workaround. A similar issue happened here https://github.com/coursier/coursier/issues/1977

fwaris commented 10 months ago

I think the issue is with our networking. The update does not work under a vpn connection but works outside of it

wpopielarski commented 3 months ago

@tgodzik unfortunately the trick with -noverify is not working for metals extension in vscode behind vpn.

tgodzik commented 3 months ago

We've had similar issue in Scala CLI more recently. Maybe something in https://github.com/VirtusLab/scala-cli/issues/2191 might help?

fwaris commented 3 months ago

in my case, the issue was related to the zscaler proxy (which intercepts ssl). To fix I had add the ZScaler root SSL cert to the java keystore. Another option is to use the option -Djavax.net.ssl.trustStoreType=WINDOWS-ROOT to make jdk use the windows store


From: Tomasz Godzik @.> Sent: May 20, 2024 3:08 PM To: scalameta/metals-vscode @.> Cc: fwaris @.>; State change @.> Subject: Re: [scalameta/metals-vscode] vscode metals not updating as download fails with ssl errors (Issue #1430)

We've had similar issue in Scala CLI more recently. Maybe something in VirtusLab/scala-cli#2191https://github.com/VirtusLab/scala-cli/issues/2191 might help?

— Reply to this email directly, view it on GitHubhttps://github.com/scalameta/metals-vscode/issues/1430#issuecomment-2121039202, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AACGZMHSQCNFEMJDZNGE25DZDJC3HAVCNFSM6AAAAAA5UTEGYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRRGAZTSMRQGI. You are receiving this because you modified the open/close state.Message ID: @.***>

wpopielarski commented 3 months ago

so to install metals 1.3.1 and bloop 1.5.17 in viscose I did steps:

  1. decrease metals extension version to 1.27 to allow crousier to load newest artifacts (to skip that certificate annoying problem, I had set -noverify but not sure if any impact of it)
  2. install metals 1.3.1
  3. restore version of extension back to 1.34.0
  4. so in this point I faced problem with starting of bloop server so in step
  5. restart Mac
  6. coffee after 4 hours of investigation
tgodzik commented 3 months ago

You can use sbt BSP as alternative. What logs do you see when it doesn't start?