Livebook certificate issue - reason: {:failed_connect, [{:to_address, {~c"hex.pm", 443}}

Hello,

I’m trying to use Livebook on my work computer but got some issues because of certificates that we have for our proxy / firewall.

The first problem I got was that I couldn’t install and search for hex packages.

The installation part could be fixed by adding the following to .livebookdesktop.sh

export HEX_CACERTS_PATH=/path/to/cert

But the search for hex packages does not work and I get the following error:

Failed to make a request, reason: {:failed_connect, [{:to_address, {~c"hex.pm", 443}}, {:inet, [:inet], {:tls_alert, {:unknown_ca, ~c"TLS client: In state wait_cert_cr at ssl_handshake.erl:2138 generated CLIENT ALERT: Fatal - Unknown CA\n"}}}]}

And if I try to setup a http client in Livebook and tries to call a microservice I got a similar error.

In Java I can install the certificate using keytool and all this kind of errors disappears. Is it possible to set a flag or something that picks up the certificate when the BEAM starts so all these errors disappears?

Hey, Livebook v0.11.3+ supports custom certificates file : )

LIVEBOOK_CACERTFILE - path to a local file containing CA certificates. Those certificates are used during for server authentication when Livebook accesses files from external sources.

4 Likes

Thanks! That made the search for packages to work :+1:

However, I cannot download some hex packages that download stuff from Github but that is probably not related to Livebook.