Closed stuharben closed 1 year ago
I have the same error
This was a mistake on my end, I can't replicate this error
@DavidVaness I found the build script should move the node_modules folder to either node16 or node18 and ensure there should be no /opt/nodejs/node_modules folder, still have to fix it. May I know if you could run your Lambda function or not at the moment?
I am sorry, I have this error on node18, must have been some caching issue that lead me to assume the 18 works while receiving data from the working v16
And the error message supports your path to fix the issue, as he is unable to link the files
{ "errorType": "Error", "errorMessage": "/var/task/node_modules/canvas/build/Release/canvas.node: invalid ELF header", "code": "ERR_DLOPEN_FAILED", "stack": [ "Error: /var/task/node_modules/canvas/build/Release/canvas.node: invalid ELF header", " at Module._extensions..node (node:internal/modules/cjs/loader:1243:18)", " at Module.load (node:internal/modules/cjs/loader:1037:32)", " at Module._load (node:internal/modules/cjs/loader:878:12)", " at Module.require (node:internal/modules/cjs/loader:1061:19)", " at require (node:internal/modules/cjs/helpers:103:18)", " at Object.<anonymous> (/var/task/node_modules/canvas/lib/bindings.js:3:18)", " at Module._compile (node:internal/modules/cjs/loader:1159:14)", " at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)", " at Module.load (node:internal/modules/cjs/loader:1037:32)", " at Module._load (node:internal/modules/cjs/loader:878:12)", " at Module.require (node:internal/modules/cjs/loader:1061:19)", " at require (node:internal/modules/cjs/helpers:103:18)", " at Object.<anonymous> (/var/task/node_modules/canvas/lib/canvas.js:9:18)", " at Module._compile (node:internal/modules/cjs/loader:1159:14)", " at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)", " at Module.load (node:internal/modules/cjs/loader:1037:32)", " at Module._load (node:internal/modules/cjs/loader:878:12)", " at Module.require (node:internal/modules/cjs/loader:1061:19)", " at require (node:internal/modules/cjs/helpers:103:18)", " at Object.<anonymous> (/var/task/node_modules/canvas/index.js:1:16)", " at Module._compile (node:internal/modules/cjs/loader:1159:14)", " at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)", " at Module.load (node:internal/modules/cjs/loader:1037:32)", " at Module._load (node:internal/modules/cjs/loader:878:12)", " at Module.require (node:internal/modules/cjs/loader:1061:19)", " at require (node:internal/modules/cjs/helpers:103:18)", " at node_modules/konva/cmj/index-node.js (/node_modules/konva/cmj/index-node.js:4:16)", " at __require (/var/task/src/functions/render/handler.js:9:51)", " at Object.<anonymous> (/src/libs/canvas-creatives/entities/socialmedia/socialmedia.entity.ts:1:19)", " at Module._compile (node:internal/modules/cjs/loader:1159:14)", " at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)", " at Module.load (node:internal/modules/cjs/loader:1037:32)", " at Module._load (node:internal/modules/cjs/loader:878:12)", " at Module.require (node:internal/modules/cjs/loader:1061:19)", " at require (node:internal/modules/cjs/helpers:103:18)", " at _tryRequireFile (file:///var/runtime/index.mjs:915:37)", " at _tryRequire (file:///var/runtime/index.mjs:965:25)", " at _loadUserApp (file:///var/runtime/index.mjs:994:22)", " at UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1035:27)", " at start (file:///var/runtime/index.mjs:1200:42)", " at file:///var/runtime/index.mjs:1206:7", " at ModuleJob.run (node:internal/modules/esm/module_job:193:25)", " at async Promise.all (index 0)", " at async ESMLoader.import (node:internal/modules/esm/loader:530:24)", " at async loadESM (node:internal/process/esm_loader:91:5)", " at async handleMainPromise (node:internal/modules/run_main:65:12)" ] } | 2023-01-16T14:57:22.300Z undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"/var/task/node_modules/canvas/build/Release/canvas.node: invalid ELF header","code":"ERR_DLOPEN_FAILED","stack":["Error: /var/task/node_modules/canvas/build/Release/canvas.node: invalid ELF header"," at Module._extensions..node (node:internal/modules/cjs/loader:1243:18)"," at Module.load (node:internal/modules/cjs/loader:1037:32)"," at Module._load (node:internal/modules/cjs/loader:878:12)"," at Module.require (node:internal/modules/cjs/loader:1061:19)"," at require (node:internal/modules/cjs/helpers:103:18)"," at Object.<anonymous> (/var/task/node_modules/canvas/lib/bindings.js:3:18)"," at Module._compile (node:internal/modules/cjs/loader:1159:14)"," at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)"," at Module.load (node:internal/modules/cjs/loader:1037:32)"," at Module._load (node:internal/modules/cjs/loader:878:12)"," at Module.require (node:internal/modules/cjs/loader:1061:19)"," at require (node:internal/modules/cjs/helpers:103:18)"," at Object.<anonymous> (/var/task/node_modules/canvas/lib/canvas.js:9:18)"," at Module._compile (node:internal/modules/cjs/loader:1159:14)"," at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)"," at Module.load (node:internal/modules/cjs/loader:1037:32)"," at Module._load (node:internal/modules/cjs/loader:878:12)"," at Module.require (node:internal/modules/cjs/loader:1061:19)"," at require (node:internal/modules/cjs/helpers:103:18)"," at Object.<anonymous> (/var/task/node_modules/canvas/index.js:1:16)"," at Module._compile (node:internal/modules/cjs/loader:1159:14)"," at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)"," at Module.load (node:internal/modules/cjs/loader:1037:32)"," at Module._load (node:internal/modules/cjs/loader:878:12)"," at Module.require (node:internal/modules/cjs/loader:1061:19)"," at require (node:internal/modules/cjs/helpers:103:18)"," at node_modules/konva/cmj/index-node.js (/node_modules/konva/cmj/index-node.js:4:16)"," at __require (/var/task/src/functions/render/handler.js:9:51)"," at Object.<anonymous> (/src/libs/canvas-creatives/entities/socialmedia/socialmedia.entity.ts:1:19)"," at Module._compile (node:internal/modules/cjs/loader:1159:14)"," at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)"," at Module.load (node:internal/modules/cjs/loader:1037:32)"," at Module._load (node:internal/modules/cjs/loader:878:12)"," at Module.require (node:internal/modules/cjs/loader:1061:19)"," at require (node:internal/modules/cjs/helpers:103:18)"," at _tryRequireFile (file:///var/runtime/index.mjs:915:37)"," at _tryRequire (file:///var/runtime/index.mjs:965:25)"," at _loadUserApp (file:///var/runtime/index.mjs:994:22)"," at UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1035:27)"," at start (file:///var/runtime/index.mjs:1200:42)"," at file:///var/runtime/index.mjs:1206:7"," at ModuleJob.run (node:internal/modules/esm/module_job:193:25)"," at async Promise.all (index 0)"," at async ESMLoader.import (node:internal/modules/esm/loader:530:24)"," at async loadESM (node:internal/process/esm_loader:91:5)"," at async handleMainPromise (node:internal/modules/run_main:65:12)"]}
-- | --
| 2023-01-16T15:57:22.895+01:00Copy2023-01-16T14:57:22.895Z undefined ERROR Uncaught Exception { "errorType": "Error", "errorMessage": "/var/task/node_modules/canvas/build/Release/canvas.node: invalid ELF header", "code": "ERR_DLOPEN_FAILED", "stack": [ "Error: /var/task/node_modules/canvas/build/Release/canvas.node: invalid ELF header", " at Module._extensions..node (node:internal/modules/cjs/loader:1243:18)", " at Module.load (node:internal/modules/cjs/loader:1037:32)", " at Module._load (node:internal/modules/cjs/loader:878:12)", " at Module.require (node:internal/modules/cjs/loader:1061:19)", " at require (node:internal/modules/cjs/helpers:103:18)", " at Object.<anonymous> (/var/task/node_modules/canvas/lib/bindings.js:3:18)", " at Module._compile (node:internal/modules/cjs/loader:1159:14)", " at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)", " at Module.load (node:internal/modules/cjs/loader:1037:32)", " at Module._load (node:internal/modules/cjs/loader:878:12)", " at Module.require (node:internal/modules/cjs/loader:1061:19)", " at require (node:internal/modules/cjs/helpers:103:18)", " at Object.<anonymous> (/var/task/node_modules/canvas/lib/canvas.js:9:18)", " at Module._compile (node:internal/modules/cjs/loader:1159:14)", " at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)", " at Module.load (node:internal/modules/cjs/loader:1037:32)", " at Module._load (node:internal/modules/cjs/loader:878:12)", " at Module.require (node:internal/modules/cjs/loader:1061:19)", " at require (node:internal/modules/cjs/helpers:103:18)", " at Object.<anonymous> (/var/task/node_modules/canvas/index.js:1:16)", " at Module._compile (node:internal/modules/cjs/loader:1159:14)", " at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)", " at Module.load (node:internal/modules/cjs/loader:1037:32)", " at Module._load (node:internal/modules/cjs/loader:878:12)", " at Module.require (node:internal/modules/cjs/loader:1061:19)", " at require (node:internal/modules/cjs/helpers:103:18)", " at node_modules/konva/cmj/index-node.js (/node_modules/konva/cmj/index-node.js:4:16)", " at __require (/var/task/src/functions/render/handler.js:9:51)", " at Object.<anonymous> (/src/libs/canvas-creatives/entities/socialmedia/socialmedia.entity.ts:1:19)", " at Module._compile (node:internal/modules/cjs/loader:1159:14)", " at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)", " at Module.load (node:internal/modules/cjs/loader:1037:32)", " at Module._load (node:internal/modules/cjs/loader:878:12)", " at Module.require (node:internal/modules/cjs/loader:1061:19)", " at require (node:internal/modules/cjs/helpers:103:18)", " at _tryRequireFile (file:///var/runtime/index.mjs:915:37)", " at _tryRequire (file:///var/runtime/index.mjs:965:25)", " at _loadUserApp (file:///var/runtime/index.mjs:994:22)", " at UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1035:27)", " at start (file:///var/runtime/index.mjs:1200:42)", " at file:///var/runtime/index.mjs:1206:7", " at ModuleJob.run (node:internal/modules/esm/module_job:193:25)", " at async Promise.all (index 0)", " at async ESMLoader.import (node:internal/modules/esm/loader:530:24)", " at async loadESM (node:internal/process/esm_loader:91:5)", " at async handleMainPromise (node:internal/modules/run_main:65:12)" ] }
<br class="Apple-interchange-newline">
@DavidVaness, @stuharben,
The maintenance release v2.11.1 of the canvas layer has just been updated on serverless repo, could you please try the latest release? You may deploy the latest layer through the serverless repo or upload the latest release from the Releases section. Please let me know if the release works stable at your side or not. Thank you.
Hi @charoitel - thank you for this work. Really helped me out.
We built the layer using your AWS serverless application. It works fine in v16, though when using as a layer in Node v18 we get intermittent errors:
We also used Cloud9 to step through your code and run it just for Node v18 and it gives a similar error:
Thank you so much in advance!