rust-analyzer: VS Code extension installation error: unable to verify the first certificate

Hi there, I tried installing rust-analyzer extension via remote SSH in vscode behind a corporate proxy. But it failed with such message:

ERROR [11/26/2021, 9:29:50 AM]: Bootstrap error [st [FetchError]: request to https://api.github.com/repos/rust-analyzer/rust-analyzer/releases/tags/2021-11-22 failed, reason: unable to verify the first certificate
	at ClientRequest.<anonymous> (/home/me/.vscode-server/extensions/matklad.rust-analyzer-0.2.826/out/main.js:39:48367)
	at ClientRequest.emit (events.js:315:20)
	at TLSSocket.socketErrorListener (_http_client.js:469:9)
	at TLSSocket.emit (events.js:315:20)
	at emitErrorNT (internal/streams/destroy.js:106:8)
	at emitErrorCloseNT (internal/streams/destroy.js:74:3)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  type: 'system',
  errno: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
  code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
}

I have set http.proxyStrictSSL to false and http.proxy properly, and don’t have problem with installing other extensions. My git and cargo both work fine from cmdline. Github API (the above url) is reachable as well. What could be the problem here? Thanks a lot in advance!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 26 (14 by maintainers)

Commits related to this issue

Most upvoted comments

You can try setting NODE_TLS_REJECT_UNAUTHORIZED=0. You might need to add it to your .profile or somewhere.

It worked like a charm. Many many thanks! I still hope this can be configurable anyway via this extension’s settings.

p.s. for googlers who land here, to solely set NODE_TLS_REJECT_UNAUTHORIZED=0 is not really sufficient for my case as I was facing this issue in the SSH remote mode. To make it work, I killed all the running code or vscode-server processes on the remote server, set this var via export NODE_TLS_REJECT_UNAUTHORIZED=0 (or inject this line to the .bashrc or .zshrc or .profile), then restarted vscode and installed this extension successfully. Now I can enjoy rust-analyzer 😃

Thank you @lnicola for your kind help! I think you can consider closing this ticket if the abovementioned extension setting is not easy to implement very soon. This env var solution is acceptable for me.