Skip to content
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

How to use prebuild for AWS lambda? #2376

Closed
1 task done
GeorgeTailor opened this issue Apr 19, 2024 · 2 comments
Closed
1 task done

How to use prebuild for AWS lambda? #2376

GeorgeTailor opened this issue Apr 19, 2024 · 2 comments

Comments

@GeorgeTailor
Copy link

Issue or Feature

I am not sure how is this supposed to work, AWS lambda suggests to put external dependencies into separate zip with the following structure:

xray-sdk.zip
└ nodejs/node_modules/aws-xray-sdk

in case of canvas I would expect something like:

canvas.zip
└ nodejs/node_modules/canvas

however releases page includes confusing info:

  1. the name of the release includes node_modules_version instead of node version
  2. the downloaded zip contains nothing that is expected by the lambda as per docs

Steps to Reproduce

Your Environment

  • Version of node-canvas v2.11.2
  • Environment node 20 on AWS Lambda x86_64 – 64-bit x86 architecture, for x86-based processors.
@arcovaa
Copy link

arcovaa commented May 11, 2024

simply copying the module from a non-Linux system won't work. You need to either compile the module directly on an Amazon Linux environment or use a Docker container that mimics Lambda's environment.

@zbjornson
Copy link
Collaborator

I recommend using a docker container on Lambda. The node-canvas prebuild is 30 MB and Lambda's ZIP limit is only 50 MB, so you're likely to hit that limit if you have many other dependencies. Using a docker container also makes it much easier to get the right prebuild installed.

https://docs.aws.amazon.com/lambda/latest/dg/nodejs-image.html#nodejs-image-instructions


I'm trying to close out as many of the dozens of installation issues as possible. If the above doesn't work and I miss a ping here to reopen this issue, please don't hesitate to open a new one.

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

No branches or pull requests

3 participants