Resend api erro pubkey_os_cacerts.erl in :pubkey_os_cacerts.get/0

I am building my company’s website, so I decided to use Resend for mailing.

Locally. All works fine, but when I put my website on production, the Resend API doesn’t work, and sentry shows me the error below.

mi config is:
elixir Version:1.15.4 (compiled with Erlang/OTP 26)
Phoenix: 1.7.7
resend: 0.4

no match of right-hand side value: {: error, :enoent}

pubkey_os_cacerts.erl in :pubkey_os_cacerts.get/0 at line 38
httpc.erl in :httpc.ssl_verify_host_options/1 at line 476
httpc.erl in anonymous fn/0 in :httpc.http_options_default/0 at line 1015
httpc.erl in :httpc.http_options/3 at line 961
httpc.erl in :httpc.handle_request/9 at line 771
lib/tesla/adapter/httpc.ex in Tesla.Adapter.Httpc.request/2 at line 52
lib/tesla/adapter/httpc.ex in Tesla.Adapter.Httpc.call/2 at line 22
lib/tesla/middleware/json.ex in Tesla.Middleware.JSON.call/3 at line 54

Looks like Erlang has trouble locating the CA certificate trust store of the operating system. You may have to install some OS package that provides a CA trust store. Or you may be running on an OS flavour/version that Erlang does not (yet) support.

Alternatively you could add castore | Hex or certifi | Hex as a dependency and customise the httpc middleware SSL options to pick up the trust store they provide. Or use a different Tesla adapter, e.g. Finch, that uses those packages by default.

3 Likes