Fix Elixir :public_key.cacerts_get/0 undefined on seenode | Seenode Docs

Fix Elixir :public_key.cacerts_get/0 undefined on seenode

The Phoenix/Elixir error ':public_key.cacerts_get/0 is undefined' means your Erlang/OTP is too old. Use OTP 25+.

The error

Building or booting your Phoenix app fails with:

function :public_key.cacerts_get/0 is undefined or private

It usually surfaces from an HTTP client or mailer (Finch, Swoosh, Tesla, Hackney) that loads the system’s CA certificates.

Quick fix

:public_key.cacerts_get/0 was added in Erlang/OTP 25. The error means your build is using an older OTP. Build against OTP 25 or newer:

  • On seenode, select the Elixir runtime in the service’s Image (see Runtimes and versions); it ships a modern OTP that includes cacerts_get/0.
  • Locally / elsewhere, upgrade Erlang/OTP to 25+ (for example via asdf or your package manager) so your build and the platform match.

If a library still can’t find CA certs, add the castore package and configure the client to use CAStore.file_path/0.

Why this happens

:public_key.cacerts_get/0 reads the OS trust store so TLS clients can verify certificates without bundling their own. It simply doesn’t exist before OTP 25, so any dependency that calls it fails to compile or run on older OTP.

Checklist

  • The build uses Elixir on an OTP 25+ toolchain.
  • Your local OTP version matches (or is not older than) the platform’s.
  • TLS-using deps (Finch/Swoosh/Tesla) are on recent versions.