Node module with compiled binary isn't working


I’m trying to run a node module on aws.

I’m using a node module called “hummus” which contains 'hummus.node" a compiled C++ library.

As soon as I require(“hummus”) it will break with following. Any suggestion on what I’m doing wrong?

module initialization error: Error
at Object.exports.find (/var/task/pdf_watcher/index.js:142672:15)
at Object. (/var/task/pdf_watcher/index.js:140663:27)
at Object.459…/PDFRStreamForFile (/var/task/pdf_watcher/index.js:140689:4)
at s (/var/task/pdf_watcher/index.js:1:682)
at /var/task/pdf_watcher/index.js:1:733
at Object.518…/lib/fileHelper (/var/task/pdf_watcher/index.js:148752:16)
at s (/var/task/pdf_watcher/index.js:1:682)
at e (/var/task/pdf_watcher/index.js:1:853)
at /var/task/pdf_watcher/index.js:1:871
at a (/var/task/pdf_watcher/index.js:1:150)
at Object. (/var/task/pdf_watcher/index.js:1:384)
at Module._compile (module.js:570:32)
at Object.Module._extensions…js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

You binary will need to be compiled to work on the AWS Linux-based container that Lambda runs in.

If you’ve got Docker, you could compile you package inside and it should run in Lambda.

Thanks @rowanu that Docker lambda helped me debug and build.

1 Like