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

requests/urllib3 installation broken in Dockerfile.db #70

Closed
hrodmn opened this issue May 16, 2023 · 3 comments · Fixed by #71
Closed

requests/urllib3 installation broken in Dockerfile.db #70

hrodmn opened this issue May 16, 2023 · 3 comments · Fixed by #71
Labels
bug Something isn't working

Comments

@hrodmn
Copy link
Contributor

hrodmn commented May 16, 2023

I tried running the deployment process because eoAPI sounds AWESOME but I hit a snag on the database deployment. I got it working but it's worth a PR to fix it.

Problem description

A recent upgrade to urllib3 seems to have broken the version of requests that gets installed in Dockerfile.db so the BootstrappedDb deployment fails.

I can't seem to get a full traceback from AWS CloudWatch but here is the error message:

[ERROR] Runtime.ImportModuleError: Unable to import module 'handler': cannot import name 'DEFAULT_CIPHERS' from 'urllib3.util.ssl_' (/var/task/urllib3/util/ssl_.py)

I was able to fix the problem by explicitly installing urllib3<2 in Dockerfile.db:

diff --git a/infrastructure/aws/dockerfiles/Dockerfile.db b/infrastructure/aws/dockerfiles/Dockerfile.db
index 52df1b4..17c4d23 100644
--- a/infrastructure/aws/dockerfiles/Dockerfile.db
+++ b/infrastructure/aws/dockerfiles/Dockerfile.db
@@ -10,7 +10,7 @@ WORKDIR /tmp
 RUN python -m pip install pip -U
 
 RUN echo "Using PGSTAC Version ${PGSTAC_VERSION}"
-RUN python -m pip install requests psycopg["binary,pool"] pypgstac==${PGSTAC_VERSION} -t /asset
+RUN python -m pip install urllib<2 requests psycopg["binary,pool"] pypgstac==${PGSTAC_VERSION} -t /asset
 
 COPY infrastructure/aws/handlers/db_handler.py /asset/handler.py

Here is a relevant issue in requests: psf/requests#6432
requests v2.30.0 should be working with urllib3>2 but maybe we are pinned to something less than v2.30.0 by another package. I haven't run the docker network locally yet but will try to dig in to find out the actual best solution.

Environment Information

Ubuntu 22.04, Python 3.10.6

@hrodmn hrodmn added the bug Something isn't working label May 16, 2023
@vincentsarago
Copy link
Member

oh nice catch 🙏

I'm sorry because I know that debugging BootstrapedDb step must have been a pain.

I'm not a big fan of requests so I'm going to fix this by replacing it with httpx 😄

@vincentsarago
Copy link
Member

should be fixed with latest commit in main 🙏

@hrodmn
Copy link
Contributor Author

hrodmn commented May 16, 2023

I'm sorry because I know that debugging BootstrapedDb step must have been a pain.

I got lucky. I tweaked Dockerfile.db and tried again - it worked!

I'm not a big fan of requests so I'm going to fix this by replacing it with httpx smile

Excellent - thanks for the quick fix!

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

Successfully merging a pull request may close this issue.

2 participants