Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

"invalid ELF header" in AWS Lambda #201

Open
kdybicz opened this issue Mar 14, 2021 · 3 comments
Open

"invalid ELF header" in AWS Lambda #201

kdybicz opened this issue Mar 14, 2021 · 3 comments

Comments

@kdybicz
Copy link

kdybicz commented Mar 14, 2021

Hey,

I was trying to use Snappy to compress some data before pushing them to a datastore in my Node 12.x Lambda. Unfortunately I'm getting below error:

2021-03-14T13:39:14.674Z	undefined	ERROR	Uncaught Exception 	
{
    "errorType": "Error",
    "errorMessage": "/var/task/node_modules/snappy/build/Release/binding.node: invalid ELF header",
    "stack": [
        "Error: /var/task/node_modules/snappy/build/Release/binding.node: invalid ELF header",
        "    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1057:18)",
        "    at Module.load (internal/modules/cjs/loader.js:863:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
        "    at Module.require (internal/modules/cjs/loader.js:887:19)",
        "    at require (internal/modules/cjs/helpers.js:74:18)",
        "    at bindings (/var/task/node_modules/bindings/bindings.js:112:48)",
        "    at Object.<anonymous> (/var/task/node_modules/snappy/snappy.js:2:34)",
        "    at Module._compile (internal/modules/cjs/loader.js:999:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
        "    at Module.load (internal/modules/cjs/loader.js:863:32)"
    ]
}

Any ideas how I could solve that problem?

@kdybicz
Copy link
Author

kdybicz commented Mar 14, 2021

huh... I've solved it by googling a bit more. Turned out that the environment from which I'm running the deployment makes the difference. Lambda with Snappy is failing when deployed from macOS but it's working just fine when deployed from linux machine. I guess you can close that Issue, though I think it could make sense to write this down in some docs?

@kdybicz
Copy link
Author

kdybicz commented Mar 22, 2021

Though, I would still like to know how to deploy to linux Lambda nodes from macOS machine without such problems... any hints?

@kdybicz
Copy link
Author

kdybicz commented Mar 23, 2021

Found this workaround so far serverless/serverless#308 (comment)

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

No branches or pull requests

1 participant