Code Monkey home page Code Monkey logo

lambda-layer-canvas-fabric-arm64's Introduction

lambda-layer-canvas-fabric-arm64

AWS Lambda Layer with node-canvas and Fabric included for ARM64 runtime

Do It by Yourself

Oh! You want to make your own layer with different version!? Don't worry we got you covered

Create an EC2 instance with Amazon Linux 2, you cannot get your node-canvas running if build environment is different from lambda (tl;dr mismatch glibc version)

Future note: It's possible that you come from the future and Amazon Linux 2 is no longer active runtime for Lambda. Check your current lambda operating system at AWS Docs, if it is ping me please and i will try to update docs later

AMI configuration

Then, install required dependencies for creating lambda layer by calling a script

./initialize.sh

If everything goes well, then you're ready to build a layer! Specifying your preferred canvas, and fabric version in build.sh then execute it

./build.sh

As a final result, you should have layer.zip at dist/ directory. Upload it to Lambda layer, and you should be ready to go.

Using them

Just add layer to Lambda function, and you should be able to use them normally

import canvas from 'canvas'
import fabric from 'fabric'

// code below

Troubleshooting

1. Some dependencies are not exist while building canvas

Check compiling section of node-canvas repository, try to check that is there some package were addded and initialize command does not have

node-canvas Repo

2. It broke my function!

Please make sure that

  • You're running lambda function as arm64
  • Your created EC2 instance is an arm64 instance
  • Node version for your Lambda runtime, and EC2 instance are the same major version

3. I want to build with different Node version

Check this line of initizlization. You can change way to install Node here. Just make sure that you're installing arm64 version of Node, not amd64

lambda-layer-canvas-fabric-arm64's People

Contributors

rayriffy avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

otamay

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.