Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vercel preview deployments broken due to urllib3 issue #265

Closed
thibaudcolas opened this issue Jul 14, 2023 · 3 comments
Closed

Vercel preview deployments broken due to urllib3 issue #265

thibaudcolas opened this issue Jul 14, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@thibaudcolas
Copy link
Member

thibaudcolas commented Jul 14, 2023

Our preview deployments in Vercel are broken because they run in Amazon Linux 2 images, which only have very dated versions of Python, which use old versions of OpenSSL no longer supported by urllib3. This is the following issue: urllib3/urllib3#2168

Official guidance from urllib3: https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html#common-upgrading-issues

I have contacted Vercel support to ask if they have plans to switch build images / make it configurable. Installing Python from source is also possible but didn’t feel like the right thing. It looked like this:

# What we needed updated
yum install openssl11 openssl11-devel
# Dependency for pyenv installer
yum install git
# Dependency for pyenv fetching of Python source
yum install tar
# Dependencies for Python build from source
yum install gcc make patch zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl11-devel tk-devel libffi-devel xz-devel
# pyenv installer
curl https://pyenv.run | bash
# pyenv initialisation
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
# install desired Python version
pyenv install 3.11
# Switch to the new Python
pyenv shell 3.11

[… our actual project-specific installation steps …]

In the meantime, I’ve pinned our Vercel builds to use urllib3<2.

@thibaudcolas thibaudcolas added the bug Something isn't working label Jul 14, 2023
@laymonage
Copy link
Member

laymonage commented Jul 14, 2023

In the meantime, I’ve pinned our Vercel builds to use urllib3==1.26.16.

Out of curiosity, how did you do this? I've never used Python on Vercel before.

Also, the urllib documentation mentions that we should pin urllib<2 instead of a specific version so that we continue getting security updates.

@thibaudcolas
Copy link
Member Author

thibaudcolas commented Jul 14, 2023

Good point! Here is the now-updated installation command:

npm install && python3 -m pip install -r requirements.txt && pip install "urllib3<2" && python3 -m pip install -e .

It looks like Vercel recently introduced support for defining build commands in their configuration file (or I somehow never saw it until now) – if we did this, here is what our full configuration would look like:

{
  "installCommand": "npm install && python3 -m pip install -r requirements.txt && pip install urllib3<2 && python3 -m pip install -e .",
  "buildCommand": "npm run build && python3 -m sphinx -M html docs/ _build",
  "outputDirectory": "_build/html",
  "github": {
    "silent": true
  }
}

@laymonage
Copy link
Member

We no longer use Vercel for this theme, so I'm closing this. Preview deployments are now provided by RTD directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants