julianhille / MuhammaraJS

Muhammara a node module with c/cpp bindings to modify PDF with js for node or electron (based/replacement on/of galkhana/hummusjs)
Other
205 stars 43 forks source link

AWS Lambda Node 18 + Codebuild #310

Closed leantorres73 closed 1 year ago

leantorres73 commented 1 year ago

Hi,

I'm getting this error when running an AWS lambda with muhammara on the latest codebuild + lambda node version:

/lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/task/node_modules/muhammara/binding/muhammara.node)

I'm using Node 18 Lambda runtime version and I have tried with both

aws/codebuild/amazonlinux2-x86_64-standard:5.0 and aws/codebuild/standard:7.0

Any ideas?

julianhille commented 1 year ago

Are you building locally or using pre built out building on AWS?

leantorres73 commented 1 year ago

@julianhille not locally, everything in AWS (I know I can't locally as I have a Mac and it's incompatible)

julianhille commented 1 year ago

Interesting. Do you deploy with the same version? Are you able to downgrade the build environment ? It seems like the build env libc does not fit the deploy/runner env version of it.

leantorres73 commented 1 year ago

I can try with more combinations, so far what I did is to use both Linux 2 and Ubuntu images that have support for Node 18 (https://docs.aws.amazon.com/codebuild/latest/userguide/available-runtimes.html). If I downgrade the build environment I will have to manually install Node 18 in there. I will let you know,

julianhille commented 1 year ago

Node 18 needs glibc 2.27 you seem to build on an env where glibc 2.29 is installed but try to run it on an env where this is the case and only 2.27 is installed.

julianhille commented 1 year ago

It seems that the Ubuntu version is 18.04 where you try to run it. Try upgrading it to 20.04 it should come with 2.31 as version which is backwards compatible to 2.29

julianhille commented 1 year ago

Another possibility would be, if applicable, to not build on the AWS machine but use the prebuilts. It think they use older globc version like 2.27 or maybe older.

julianhille commented 1 year ago

Did you since the issue? If yes how, 8f no how could I support?

vpillinger-highwater commented 1 year ago

@julianhille

The issue is that the latest binaries are compiled with GLIBC version 2.29. However, after spending most of a day on this. It is extremely difficult to get this version on any AWS Lambda instance.

AWS lambda only provides 2.26 as the newest version, so the best way would be to compile a version of the library with GLIBC 2.26. Otherwise, document an older version that isn't reliant on a newer GLIBC version.

I had to revert to using HummusJS 1.0.111 if that is helpful.

julianhille commented 1 year ago

Which specific version of muhammare you used before? I hope you don't expose muhammara to the end user as there are at least very easy ways of DOSing, if not rce, for older versions < 2.6

Can you post your npm install log on build time?

julianhille commented 1 year ago

i close this for now. it seems to be an issue with build vs deploy env

joemoongit commented 10 months ago

i was able to get muhammara working on aws lambda with node 18. i had to rebuild the binary so it compiles with glibc 2.26. rebuilding it in a docker container with image samcli/lambda-nodejs@18-x86_64 worked for me. i can provide the binary if needed

julianhille commented 10 months ago

I keep that in mind as I could easily add this docker container and build there. Thanks for reporting

leantorres73 commented 8 months ago

Awesome! Sorry I never came back to this ticket again. Thank you very much for the effort on making it available for lambda and Node 18!!