Skip to content

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

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

Open
pr1ntr opened this issue Apr 4, 2025 · 0 comments

Comments

@pr1ntr
Copy link

pr1ntr commented Apr 4, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant