Skip to content

Cannot get canvas to work on aws lambda docker containers (amazon linux 2 or AL2023) #2502

Open
@pr1ntr

Description

@pr1ntr

Dockerfile

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

ENV LD_LIBRARY_PATH="/var/task/node_modules/canvas/build/Release:${LD_LIBRARY_PATH}"
RUN dnf  install -y wget tar xz gcc-c++ cairo-devel pango-devel libjpeg-turbo-devel giflib-devel librsvg2-devel pango-devel bzip2-devel jq

RUN wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz

RUN tar -xf ffmpeg-release-amd64-static.tar.xz
RUN mv ffmpeg*/ffprobe ffmpeg*/ffmpeg /usr/local/bin



ARG GH_TOKEN

COPY . ${LAMBDA_TASK_ROOT}


WORKDIR ${LAMBDA_TASK_ROOT}

RUN echo -e "//npm.pkg.github.com/:_authToken=${GH_TOKEN}\n\
@wildlifela:registry=https://npm.pkg.github.com\n\
always-auth=true" > .npmrc

RUN npm install --build-from-source
RUN npm run build

# move the contents of dist/ folder to .
RUN cp -r dist/* .
RUN npm rebuild --update-binary

CMD ["index.handler"]

With Canvas 3.1.0
Node 18/20/22 (none will work)
Node 18 is on AL2
Node 20/22 is on AL2023

WIth this it builds however when the lambda runs I get this error
/var/lang/bin/node: /var/task/node_modules/canvas/build/Release/libstdc++.so.6: version GLIBCXX_3.4.26' not found (required by /var/lang/bin/node)`

Any help would be appreciated

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions