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
질문됨 6달 전789회 조회
1개 답변
0
수락된 답변

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
답변함 6달 전
  • Thanks for your comment, emptying LD_LIBRARY_PATH did help.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인