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

Invalid ELF Header on Lambda Function #196

Open
giocodebot opened this issue Sep 2, 2020 · 5 comments
Open

Invalid ELF Header on Lambda Function #196

giocodebot opened this issue Sep 2, 2020 · 5 comments

Comments

@giocodebot
Copy link

giocodebot commented Sep 2, 2020

Hi! I hope you can help me, I'm trying to run it on a Lambda funtion running NodeJS 12.x but when I call it I receive the following error, thank you!
image

@chunyenHuang
Copy link
Owner

Can you post this in muhammara as well? It seems to me it's a hummusJS related issue.

@lkowalski-smartbusiness
Copy link

lkowalski-smartbusiness commented Sep 17, 2020

@giocodebot I overcame the issue by creating a separate layer for the HummusRecipe + Muhammara packages and repackaging it using a LambCI docker image (clear your .node_modules beforehand):

docker run --rm -v "$PWD":/var/task lambci/lambda:build-nodejs12.x npm install
mkdir .output
docker run --rm -v "$PWD":/var/task lambci/lambda:build-nodejs12.x zip -r --symlinks .output/output.zip . -x '*.git*' -x '*.output*'

I use a separate layer to avoid tedious repackaging on every change

@midnite81
Copy link

@lkowalski-smartbusiness When you say you create a seperate layer - do you mean with only the HummusRecipe + Muhammara in it, or do you mean your project as a whole and then the output.zip is uploaded as your main project on the lambda?

@lkowalski-smartbusiness

@midnite81 I meant just the HummusRecipe + Muhammara but I stand corrected as there were various issues to that approach (most likely some libraries overlapping in the layer and the actual lambda function that was built the normal way, haven't had the time to investigate deeply).
What I did for it to work "right here, right now" is:

  • delete the node_modules directory (if one exists) for the function using HummusRecipe
  • run just the first command from my previous snippet (docker run --rm -v "$PWD":/var/task lambci/lambda:build-nodejs12.x npm install)
  • perform regular lambda deployment, if it includes build phase the installed modules will not get overwritten (as long as the versions still align!)

I'll be following up with my findings for a proper layer with just the libraries packaged in it when I do find the time to debug it properly.

@julianhille
Copy link
Collaborator

julianhille commented Dec 16, 2022

hey, this is mostly an architecture error, like you are compiling or bundling the muhammara binary on a windows machine and then upload it to lambda.
This would not work as it is a binary compiled for a specific target architecture / libc.

similar issues are here:
julianhille/MuhammaraJS#155 or here julianhille/MuhammaraJS#154

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

No branches or pull requests

5 participants