VirtusLab / scala-cli

Scala CLI is a command-line tool to interact with the Scala language. It lets you compile, run, test, and package your Scala code (and more!)
https://scala-cli.virtuslab.org
Apache License 2.0
554 stars 129 forks source link

Setting `repository.credentials` makes Coursier/Metals hang (?) #3044

Open kubukoz opened 4 months ago

kubukoz commented 4 months ago

Version(s)

1.4.0, from Nixpkgs.

Describe the bug

When I set repository.credentials, I'm unable to launch Metals. Actually, launching anything through Coursier fails.

To Reproduce

  1. scala-cli --power config repositories.credentials example.com value:user value:pass
  2. Open Metals
  3. Look at Output panel

E.g. in vscode:

image

Alternatively, in step 2 run cs launch stc. It hangs, and when interrupted with ctrl+c it prints:

Warning: failed to read repositories credentials from /Users/kubukoz/Library/Application Support/ScalaCli/secrets/config.json, ignoring it.
Note that a cs command from coursier >= v2.1.0-M7-34-gf519b50a3 is recommended.

My coursier CLI is at 2.1.10, from Nixpkgs.

Interestingly, scala-cli actually uses the credentials just fine.

Expected behaviour

No impact of setting scala-cli credentials in Coursier/Metals.

kubukoz commented 4 months ago

it looks like it's indeed Coursier's problem not scala-cli's, but since ScalaCli shows up in the error + the problem is caused by a mutation from scala-cli, I figured I'd report here first - feel free to transfer if needed

alexarchambault commented 1 month ago

I can't check right now, but I highly suspect that originates from coursier failing to read config files, as its scala-cli config dependency isn't up to date (https://github.com/coursier/coursier/pull/2933)

kubukoz commented 1 month ago

Why does Coursier depend on scala-cli config in the first place?

alexarchambault commented 1 month ago

To read the config too