jswny
OpenAI Codex (cloud) Elixir support
Has anyone managed to get Codex (the cloud version, as seen here) to work for Elixir?
I tried to setup the dependencies but mix deps.get always gives the following error:
{:failed_connect, [{:to_address, {~c"proxy", 8080}}, {:inet, [:inet], :econnrefused}]}
Failed to fetch record for plug from registry (using cache instead)
I’ve tried these but none seem to work:
export HEX_CACERTS_PATH="$CODEX_PROXY_CERT"
export HEX_UNSAFE_HTTPS="1"
My setup script that does work is this:
sudo add-apt-repository -y ppa:rabbitmq/rabbitmq-erlang
sudo apt update -y
sudo apt install -y git elixir erlang
mix archive.install github hexpm/hex branch latest --force
Installing things with Git seems fine, even mix can install deps that are pinned to a Github commit
The Docker image that runs has HTTP_PROXY and HTTPS_PROXY both set to http://proxy:8080
First Post!
jeffdeville-ethermed
Not yet… Here’s my issue:
https://github.com/openai/codex-universal/issues/30
I’ve tried a lot. Works in docker, near as I could tell. But in their environment, nothing. Killin’ me right now.
Most Liked
DavidVII
For the sake of comparing notes, here’s my experience trying to get mix deps.get working in a Codex environment. It looks like I’m hitting a proxy wall too.
Based on Codex’s documentation on internet access and proxies, here’s what I tried after installing Elixir via asdf:
-
Set all the recommended proxy and cert env vars:
export http_proxy="http://proxy:8080" export https_proxy="http://proxy:8080" export SSL_CERT_FILE="$CODEX_PROXY_CERT" export REQUESTS_CA_BUNDLE="$CODEX_PROXY_CERT" export HEX_CACERTS_PATH="$CODEX_PROXY_CERT" export HEX_HTTP_CONCURRENCY=1 -
Installed Hex manually (since
mix local.hex --forcefails with a 503):mix archive.install github hexpm/hex --branch latest --force -
Ran
mix deps.getand got this repeated error:upstream connect error or disconnect/reset before headers. reset reason: connection termination
It looks like repo.hex.pm is getting blocked entirely, or the TLS handshake is being dropped by the proxy. Even with HEX_CACERTS_PATH pointing to the Codex proxy cert, the connection fails before it completes.
I noticed the docs say:
Environments are pre-configured to work with common tools and package managers
So I’m guessing Hex just isn’t allowed yet the way pip, npm, and others are.
Would love to get this working. Happy to test more or compare setups.
FWIW here’s my full script up until I try doing mix local.hex --force
#!/usr/bin/env bash
# bootstrap_asdf_prebuilt.sh – pulls binary OTP builds, so no C tool-chain needed
set -euo pipefail
export DEBIAN_FRONTEND=noninteractive
# 1. Runtime-only libs (<< 10 MB total)
apt-get update -qq
apt-get install -y --no-install-recommends libssl3 zlib1g libncurses6
rm -rf /var/lib/apt/lists/*
# 2. asdf (same as before, but no gcc/make)
git clone -q https://github.com/asdf-vm/asdf.git /opt/asdf --branch v0.14.1
echo '. /opt/asdf/asdf.sh' >> /etc/bash.bashrc
. /opt/asdf/asdf.sh
# 3. **Pre-built** plugin for Erlang
asdf plugin add erlang https://github.com/michallepicki/asdf-erlang-prebuilt-ubuntu-24.04.git || true
asdf plugin add elixir
asdf plugin add nodejs
# 4. Honour your .tool-versions file
asdf install
asdf reshim
echo "🔥 OTP and Elixir installed"
export http_proxy="http://proxy:8080"
export https_proxy="http://proxy:8080"
export SSL_CERT_FILE="$CODEX_PROXY_CERT"
export REQUESTS_CA_BUNDLE="$CODEX_PROXY_CERT"
export HEX_CACERTS_PATH="$CODEX_PROXY_CERT"
export HEX_HTTP_CONCURRENCY=1
iamyojimbo
The underlying bug has been fixed in OTP and Elixir will work in Codex Cloud with the latest Erlang patches.
We patched erlang/otp httpc module. It has been released in OTP 28.1, 27.3.4.3 and 26.2.5.15. mix deps.get now works as expected since httpc no longer sends the te header for default GET requests.
Thanks @Damirados for the sample using Mise en Place. This works:
# make sure mise + its shims are on PATH now and later
echo 'export PATH=$HOME/.local/bin:$PATH' >> ~/.bashrc
echo 'export PATH=$HOME/.local/share/mise/shims:$PATH' >> ~/.bashrc
echo 'export HEX_CACERTS_PATH=$CODEX_PROXY_CERT' >> ~/.bashrc
export PATH=$HOME/.local/bin:$PATH
export PATH=$HOME/.local/share/mise/shims:$PATH
export HEX_CACERTS_PATH=$CODEX_PROXY_CERT
mise use --global erlang@28.1
mise use --global elixir@1.18.4-otp-28
mix deps.get
mix deps.compile
mix compile
vkryukov
Success! After spending a few hours with ChatGPT o3, I have finally managed to cast an incantation that seems to work! Some of the steps might be not necessary, and I might play with the script some more to experiment what can be safely removed.
TL;DR of the two critical steps:
- Need to compile Erlang with the right certificates (just using the binaries doesn’t seem to work). That’s unfortunate, as compiling Erlang takes the most amount of time (be patient!)
- Need to use a different Hex proxy
jsDeliverfrom Mirrors | Hex; the official one doesn’t seem to work
Here is the script - let me know if it works for you, and how we can eliminate the unnecessary settings.
Last Post!
kip
ex_cldr uses Erlang’s :httpc module to download configured locales at compile time. The error seems to be CLIENT ALERT: Fatal - Unknown CA which is a surprise to me - I’m not even sure which CA is in effect at the time you are compiling (and I am far from knowledgable about CAs). I’ve fixed the case clause error on the development branch but that doesn’t resolve the underlying error.
Ultimately it is Cldr.Http.get/2 that does the work and it has two options you might try to see if you can at least get around the error for now:
- Set the env variable
CLDR_UNSAFE_HTTPS=true(not recommended for production) - Configure (in
config.exssince it’s required for compile time) a different certificate store and see if that connects as expected. The error message indicates you have castore configured and it’s using that libraries certificate store - which is very common. Maybe you can see if there is a later version than what you have installed? There was a new version on August 12th. - You can test by doing:
iex> `Cldr.Http.get("Cldr.Http.get("https://raw.githubusercontent.com/elixir-cldr/cldr/refs/tags/v2.43.2/priv/cldr/locales/en.json")")`
These options are discussed in the documentation but added here to make it hopefully easier for you to access:
Unsafe HTTPS
If the environment variable CLDR_UNSAFE_HTTPS is
set to anything other than FALSE, false, nil
or NIL then no peer verification of certificates
is performed. Setting this variable is not recommended
but it may be required where peer verification fails for
unidentified reasons. Please open an issue
if this occurs.
Certificate stores
In order to keep dependencies to a minimum,
get/1 attempts to locate an already installed
certificate store. It will try to locate a
store in the following order which is intended
to satisfy most host systems. The certificate
store is expected to be a path name on the
host system.
# A certificate store configured by the
# developer
Application.get_env(:ex_cldr, :cacertfile)
# Populated if hex package `CAStore` is configured
CAStore.file_path()
# Populated if hex package `certfi` is configured
:certifi.cacertfile()
# Debian/Ubuntu/Gentoo etc.
"/etc/ssl/certs/ca-certificates.crt",
# Fedora/RHEL 6
"/etc/pki/tls/certs/ca-bundle.crt",
# OpenSUSE
"/etc/ssl/ca-bundle.pem",
# OpenELEC
"/etc/pki/tls/cacert.pem",
# CentOS/RHEL 7
"/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem",
# Open SSL on MacOS
"/usr/local/etc/openssl/cert.pem",
# MacOS & Alpine Linux
"/etc/ssl/cert.pem"
Popular in AI / LLMs
How does the Elixir community feel about the ethical complexities of AI, OSS, and learning/teaching?
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









