Automattic / Automattic/node-canvas

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

Open
#2,502 0 comments 0 reactions 0 assignees View on GitHub
Binaries Installation help
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.