Issues installing openssl on lambda/nodejs base image

0

I'm trying to install openssl on public.ecr.aws/lambda/nodejs:20 which is based on Amazon Linux 2023. I tried to install it on amazonlinux:2023 and it works, using dnf install openssl. and I verified it:

bash-5.2# openssl version
OpenSSL 3.0.8 7 Feb 2023 (Library: OpenSSL 3.0.8 7 Feb 2023)

However, when I try to do the same on the public.ecr.aws/lambda/nodejs:20 image, I get:

bash-5.2# openssl version
openssl: symbol lookup error: openssl: undefined symbol: SSL_get_srp_g, version OPENSSL_3.0.0

I'm not sure what causes it or why there is a difference. How can I fix it so I can use openssl in my lambda functions?

DorGO
asked 3 months ago420 views
1 Answer
0
Accepted Answer

to install python modules, use empty LD_LIBRARY_PATH environment variable:

FROM public.ecr.aws/lambda/nodejs:20

RUN dnf upgrade -y
########## CUSTOM ######################
RUN dnf install -y \
       python3 \     
       && \
    dnf clean all 
########## NODE ######################
RUN npm install -g esbuild yarn typescript && \
    npm cache clean --force
# ########## AWS SAM ######################
RUN LD_LIBRARY_PATH="" pip3 install --no-cache-dir --upgrade awscli aws-sam-cli

To confirm CLI and SAM were working, docker exec -it <containerid> sh into a running container, and my aws --version command failed with urllib3 not finding ssl, but I noticed that my shell had LD_LIBRARY_PATH=/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib - setting LD_LIBRARY_PATH="" in my shell let me successfully run CLI and SAM from the shell to check their versions:

sh-5.2# LD_LIBRARY_PATH=""

sh-5.2# aws --version

aws-cli/1.30.3 Python/3.9.16 Linux/6.3.13-linuxkit botocore/1.32.3

sh-5.2# sam --version

SAM CLI, version 1.103.0

AWS
answered 3 months ago
  • Thanks for your comment, emptying LD_LIBRARY_PATH did help.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions