-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Description
Hello, I have been trying to use ChartJsNodeCanvas with AWS Lambda + AWS Amplify, but I keep having problems with node-canvas with the error 'var/task/node_modules/canvas/build/Release/canvas.node: invalid ELF header'.
So far what I have tried is to use an AWS Lambda Layer for node-canvas:
Lambda layer
Now when I import canvas it doesn't throw error and successfully console logs it
const canvas = require('canvas')
console.log(canvas)
However the moment I import chartjs-node-canvas it throws invalid ELF header.
{
"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 Object.Module._extensions..node (node:internal/modules/cjs/loader:1282:18)",
" at Module.load (node:internal/modules/cjs/loader:1076:32)",
" at Function.Module._load (node:internal/modules/cjs/loader:911:12)",
" at Module.require (node:internal/modules/cjs/loader:1100:19)",
" at require (node:internal/modules/cjs/helpers:108:18)",
" at Object.<anonymous> (/var/task/node_modules/canvas/lib/bindings.js:3:18)",
" at Module._compile (node:internal/modules/cjs/loader:1198:14)",
" at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)",
" at Module.load (node:internal/modules/cjs/loader:1076:32)",
" at Function.Module._load (node:internal/modules/cjs/loader:911:12)"
]
}
I am confused, because the lambda layer provides node canvas version @2.11.2 which should be compatible with chartjs node canvas.
"chart.js": "^3.9.1",
"chartjs-node-canvas": "^4.1.6"
I can provide more information if this wasn't enough.
Metadata
Metadata
Assignees
Labels
No labels