charoitel / lambda-layer-canvas-nodejs

Cairo backed Mozilla Web Canvas API implementation layer for AWS Lambda
https://serverlessrepo.aws.amazon.com/applications/arn:aws:serverlessrepo:us-east-1:990551184979:applications~lambda-layer-canvas-nodejs
MIT License
87 stars 22 forks source link

ChartjsNodeCanvas depending on node canvas #19

Closed AleksandarGT closed 1 year ago

AleksandarGT commented 1 year ago

Hello I have been trying to use chartjs within a lambda function, therefore I used chartjs node canvas to create graphs in a node environment. I also use Amplify to manage my lambdas.

Lambda throws error /var/task/node_modules/canvas/build/Release/canvas.node: invalid ELF header on execution.

I tried using your lambda layer and it successed with importing canvas to my code and running it, however the moment i import chartjs node canvas the lambda throws invalid ELF header error. Is it possible that since the chartjs library depends on node-canvas, npm installs it and it overrides your lambda layer which has the correct binaries?

charoitel commented 1 year ago

Currently the only way is to remove the duplicated canvas which may need some efforts. Thanks for suggesting to add chartjs.

Would do some more round of works here and target to release in next release. Thank you~

charoitel commented 1 year ago

A new maintenance release is available through AWS Serverless Application Repository. Please deploy and try. Thank you.