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

Installing/Updating behind proxy #60

Open
liar666 opened this issue Sep 10, 2021 · 2 comments
Open

Installing/Updating behind proxy #60

liar666 opened this issue Sep 10, 2021 · 2 comments

Comments

@liar666
Copy link

liar666 commented Sep 10, 2021

Describe the bug
A clear and concise description of what the bug is.

I'm behind a proxy, opening a .scala file leads to lsp + metals trying to install/update, which results in error (buffer *metals::stderr*):

Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Error while downloading https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.7/gson-2.8.7.jar: Connection timed out (Connection timed out), ignoring it
Error while downloading https://repo1.maven.org/maven2/ch/epfl/scala/bsp4j/2.0.0-M13/bsp4j-2.0.0-M13.jar: Connection timed out (Connection timed out), ignoring it
Error while downloading https://repo1.maven.org/maven2/ch/epfl/scala/scalafix-interfaces/0.9.27/scalafix-interfaces-0.9.27.jar: Connection timed out (Connection timed out), ignoring it
Error while downloading https://repo1.maven.org/maven2/com/geirsson/metaconfig-core_2.12/0.9.11/metaconfig-core_2.12-0.9.11.jar: Connection timed out (Connection timed out), ignoring it

Process metals stderr finished

Seems that the proxy configuration is not taken into account (I've tried with env vars *_proxy and in emacs config)

To Reproduce
Steps to reproduce the behavior(sample project + file which can be used to reproduce the issue with.)

  • Be behind a proxy
  • Try to install/upgrade metals

Expected behavior
A clear and concise description of what you expected to happen.

All Emacs connexions (included lsp/lsp-* upgrades) should pass through proxy when it is configured

Screenshots
If applicable, add screenshots to help explain your problem.

Logs
Please include the debug stack trace (if there is an error) and the content of Messages buffer with lsp-print-io set to t in case the bug is related to client->server communication.
cf above

EDIT: I've also tried C-u M-x lsp-install-server metals, which seems to have worked (*messages* buffer)

Wrote /home/gmuller/.emacs.d/.cache/lsp/metals/coursier.asc
LSP :: Finished downloading /home/gmuller/.emacs.d/.cache/lsp/metals/coursier.asc...
LSP :: Verifying signature /home/gmuller/.emacs.d/.cache/lsp/metals/coursier.asc...
LSP :: Server metals downloaded, auto-starting in 0 buffers.

But without success

EDIT2: I'm discovered metals is installed in /home/user/.emacs.d/.cache/lsp/metals/metals... I've tried to run/update it manually by running the command in a terminal... Seems to ignore the proxy too....

@liar666
Copy link
Author

liar666 commented Sep 10, 2021

SOLUTION:
Using:
$ export _JAVA_OPTIONS=-Djava.net.useSystemProxies=true
$ /home/user/.emacs.d/.cache/lsp/metals/metals
worked

lsp-metals should add -Djava.net.useSystemProxies=true to any call to metals, or configure JVM's proxy from Emacs proxy configuration

WORK-AROUND:
For those with the same problem, running _JAVA_OPTIONS="$_JAVA_OPTIONS -Djava.net.useSystemProxies=true" emacs tmp/lsp/test.scala works

@kbrowder
Copy link

Afaict there's no combination of env vars that work to get flags to bootstrap at https://github.com/emacs-lsp/lsp-metals/blob/master/lsp-metals.el#L400, I guess perhaps there should be a lsp-metals-coursier-args to allow adding flags to the bootstrap step, in my case -J-Djavax.next.ssl.trustStore

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

2 participants