Giter Club home page Giter Club logo

node-canvas-lambda's Introduction

node-canvas-lambda

A node-canvas (and chart.js) layer for AWS Lambda

Build

Build new layers using the Dockerfile and copy them to the build folder. Be sure to have Docker installed then run the following command:

make build

The default version of Nodejs is 16. To build for a different node version set the NODE_VERSION:

make build NODE_VERSION=14

Publish

Upload the layers to AWS into your default region. This will build the layers if they have not already been built.

make publish

Test

A lambda image (e.g. public.ecr.aws/lambda/nodejs:16-arm64 ) can be used to test the layers by loading the layers and running a simple lambda handler that uses canvas.

The following command will unzip the layers and mount the layer folders into to the /opt/ folder of the lambda container and then run the test.js handler:

make test

If the test worked correctly the output should be a data URI. e.g.: "data:image/png;base64,iVBORw0KGgoAAAA.... You can copy the URI and paste it into our browser's url bar to see the image.

Architecture

The default architecture for these layers are ARM. If you're function uses amd64 architecute you shouldn't have any issues. If you're using x86-64 you'll need to checkout the x86-64 branch and run make build.

Debug

The build image can be used to debug any issues with the layers.

Use make debug to start an interactive bash session in the container where you can use ldd or lddtree to examine the canvas.node binary:

ldd nodejs/node_modules/canvas/build/Release/canvas.node

node-canvas-lambda's People

Contributors

jwerre avatar alexlitel avatar maxpeterson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.