Skip to content

fix: disable library path for node 20-24 images#190

Open
reedham-aws wants to merge 5 commits into
aws:developfrom
reedham-aws:node-dnf-fix
Open

fix: disable library path for node 20-24 images#190
reedham-aws wants to merge 5 commits into
aws:developfrom
reedham-aws:node-dnf-fix

Conversation

@reedham-aws
Copy link
Copy Markdown
Contributor

@reedham-aws reedham-aws commented Apr 22, 2026

Issue #, if available:
#189 is the PR where we first started seeing failures for node build images.

Description of changes:
It seems like there was a recent update to the Nodejs images using AL2023 that is causing build failures for Node 20, 22, and 24. The issue is that the dnf install that's being run when building the image from the Dockerfile is failing because it cannot find OPENSSL_3.4.0. This is actually an issue we experience in another place in the Dockerfiles, and have a workaround for it:

# Install lambda builders in a dedicated Python virtualenv
# Nodejs20 uses a different version (3.1.3) of OpenSSL. This caused an error when Python (installed via dnf) tries to use the ssl module.
# Temporarily set LD_LIBRARY_PATH to empty for python and pip to pick up the right OpenSSL version
RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/pyproject.toml | grep aws_lambda_builders | cut -d'=' -f3 | tr -d '",') && \
LD_LIBRARY_PATH= /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION"

This change makes it so the environment variable that had been interfering with Python and dnf is unset. For now, I'm not sure if I we should make this change considering it's unsetting a value that's explicitly in the base image, even if it is working.

Example of the failed run here:

#7 [ 3/12] RUN dnf groupinstall -y development &&   dnf install -y   tar   gzip   unzip   python3   jq   grep   make   rsync   binutils   gcc-c++   procps   gmp-devel   zlib-devel   libmpc-devel   python3-devel   && dnf clean all
#7 0.157 Traceback (most recent call last):
#7 0.157   File "/usr/lib64/python3.9/random.py", line 61, in <module>
#7 0.157     from _sha512 import sha512 as _sha512
#7 0.157 ModuleNotFoundError: No module named '_sha512'
#7 0.157 
#7 0.157 During handling of the above exception, another exception occurred:
#7 0.157 
#7 0.157 Traceback (most recent call last):
#7 0.157   File "/usr/bin/dnf", line 61, in <module>
#7 0.157     from dnf.cli import main
#7 0.157   File "/usr/lib/python3.9/site-packages/dnf/__init__.py", line 23, in <module>
#7 0.157     import dnf.pycomp
#7 0.157   File "/usr/lib/python3.9/site-packages/dnf/pycomp.py", line 24, in <module>
#7 0.157     import email.mime.text
#7 0.157   File "/usr/lib64/python3.9/email/mime/text.py", line 10, in <module>
#7 0.157     from email.mime.nonmultipart import MIMENonMultipart
#7 0.157   File "/usr/lib64/python3.9/email/mime/nonmultipart.py", line 10, in <module>
#7 0.157     from email.mime.base import MIMEBase
#7 0.157   File "/usr/lib64/python3.9/email/mime/base.py", line 9, in <module>
#7 0.157     import email.policy
#7 0.157   File "/usr/lib64/python3.9/email/policy.py", line 7, in <module>
#7 0.157     from email._policybase import Policy, Compat32, compat32, _extend_docstrings
#7 0.157   File "/usr/lib64/python3.9/email/_policybase.py", line 9, in <module>
#7 0.157     from email.utils import _has_surrogates
#7 0.157   File "/usr/lib64/python3.9/email/utils.py", line 28, in <module>
#7 0.158     import random
#7 0.158   File "/usr/lib64/python3.9/random.py", line 64, in <module>
#7 0.158     from hashlib import sha512 as _sha512
#7 0.158   File "/usr/lib64/python3.9/hashlib.py", line 77, in <module>
#7 0.158     import _hashlib
#7 0.158 ImportError: /var/lang/lib/libcrypto.so.3: version `OPENSSL_3.4.0' not found (required by /usr/lib64/python3.9/lib-dynload/_hashlib.cpython-39-x86_64-linux-gnu.so)
#7 ERROR: process "/bin/sh -c dnf groupinstall -y development &&   dnf install -y   tar   gzip   unzip   python3   jq   grep   make   rsync   binutils   gcc-c++   procps   gmp-devel   zlib-devel   libmpc-devel   python3-devel   && dnf clean all" did not complete successfully: exit code: 1
------
 > [ 3/12] RUN dnf groupinstall -y development &&   dnf install -y   tar   gzip   unzip   python3   jq   grep   make   rsync   binutils   gcc-c++   procps   gmp-devel   zlib-devel   libmpc-devel   python3-devel   && dnf clean all:
0.157     from email._policybase import Policy, Compat32, compat32, _extend_docstrings
0.157   File "/usr/lib64/python3.9/email/_policybase.py", line 9, in <module>
0.157     from email.utils import _has_surrogates
0.157   File "/usr/lib64/python3.9/email/utils.py", line 28, in <module>
0.158     import random
0.158   File "/usr/lib64/python3.9/random.py", line 64, in <module>
0.158     from hashlib import sha512 as _sha512
0.158   File "/usr/lib64/python3.9/hashlib.py", line 77, in <module>
0.158     import _hashlib
0.158 ImportError: /var/lang/lib/libcrypto.so.3: version `OPENSSL_3.4.0' not found (required by /usr/lib64/python3.9/lib-dynload/_hashlib.cpython-39-x86_64-linux-gnu.so)
------
Dockerfile-nodejs20x:12
--------------------
  11 |     
  12 | >>> RUN dnf groupinstall -y development && \
  13 | >>>   dnf install -y \
  14 | >>>   tar \
  15 | >>>   gzip \
  16 | >>>   unzip \
  17 | >>>   python3 \
  18 | >>>   jq \
  19 | >>>   grep \
  20 | >>>   make \
  21 | >>>   rsync \
  22 | >>>   binutils \
  23 | >>>   gcc-c++ \
  24 | >>>   procps \
  25 | >>>   gmp-devel \
  26 | >>>   zlib-devel \
  27 | >>>   libmpc-devel \
  28 | >>>   python3-devel \
  29 | >>>   && dnf clean all
  30 |       
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c dnf groupinstall -y development &&   dnf install -y   tar   gzip   unzip   python3   jq   grep   make   rsync   binutils   gcc-c++   procps   gmp-devel   zlib-devel   libmpc-devel   python3-devel   && dnf clean all" did not complete successfully: exit code: 1
make: *** [Makefile:58: build-multi-arch] Error 1

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@reedham-aws reedham-aws requested a review from a team as a code owner April 22, 2026 17:13
@reedham-aws reedham-aws changed the title fix: disable library path while doing dnf install for node images fix: disable library path for node 20-24 images Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants