Works great on Mac, but when used in an AWS Lambda function, this module throws an error during require():
Error: /var/task/node_modules/xxhash/build/Release/hash.node: invalid ELF header
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/task/node_modules/xxhash/lib/xxhash.js:4:13)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
The module is npm installed on mac and zipped for deployment to Lambda. Does it use something specific where it would need to be installed on AWS Linux only in order to work in Lambda? Haven't had to do that for any other modules yet.
A quick search shows we might have to npm install bcrypt? https://stackoverflow.com/questions/15809611/bcrypt-invalid-elf-header-when-running-node-app I haven't tried it as I just went for a crypto built-in hash, but if that is the case it would be nice to call out Mac support in the README of xxHash.
Native modules are similarly installed and deployed, but you鈥檒l need to build them against the Amazon Linux libraries.
https://aws.amazon.com/blogs/compute/nodejs-packages-in-lambda/
nice answer @ifduyue !
I hope it helps your issue @rickyblaha
Most helpful comment
https://aws.amazon.com/blogs/compute/nodejs-packages-in-lambda/