I get the following error when I try to load the pdfnet library on aws lambda
INFO Error: Error: /opt/nodejs/node_modules/@pdftron/pdfnet-node/lib/addon.node: invalid ELF header at Object.Module._extensions..node (internal/modules/cjs/loader.js:1144:18) at Module.load (internal/modules/cjs/loader.js:950:32) at Function.Module._load (internal/modules/cjs/loader.js:790:12) at Module.require (internal/modules/cjs/loader.js:974:19) at require (internal/modules/cjs/helpers.js:101:18) at Object.loadWorker (/opt/nodejs/node_modules/@pdftron/pdfnet-node/lib/pdfnet.js:40:357) at /opt/nodejs/node_modules/@pdftron/pdfnet-node/lib/pdfnet.js:1163:363 at new Promise (<anonymous>) at Object.t.preloadWorker (/opt/nodejs/node_modules/@pdftron/pdfnet-node/lib/pdfnet.js:1161:233) at Object.t.preloadPDFWorker (/opt/nodejs/node_modules/@pdftron/pdfnet-node/lib/pdfnet.js:1161:157) { code: 'ERR_DLOPEN_FAILED' }
nodejs version is 14.x
pdftron installed by nodejs version 14.x
does it not work in aws lambda nodejs evironment ?
As Ryan mentioned above, it’s a binary issue. Node modules need to be compiled for the target environment. If you’re supplying a .zip for the Lambda source code, and in that .zip is node modules compiled locally, it’s not going to work. See this post: