in

Skia Canvas : ERR_DLOPEN_FAILED


So im using canvas-constructor (dependent on Skia canvas) to do some image processing (instead of node-canvas due to incompatibility issues with sharp library)

Whenever i run my code locally, it runs flawlessly.

When i deploy it to AWS and run my lambda, I get the following error :

My Lambda code (Not Working) :

         let SERIALIZED = frameDom.serialize() //returns a string

         SERIALIZED = SERIALIZED.replace('<html>','')
         SERIALIZED = SERIALIZED.replace('</html>','')
         SERIALIZED = SERIALIZED.replace('<head>','')
         SERIALIZED = SERIALIZED.replace('</head>','')
         SERIALIZED = SERIALIZED.replace('<body>','')
         SERIALIZED = SERIALIZED.replace('</body>','')

         sharp(Buffer.from(SERIALIZED,'utf-8')).toFormat("png").toBuffer(async (err, data, info) => {
                          
               //data is output file buffer

               const image = await resolveImage(data);
               let _canvas = new Canvas(97, 96).printImage(image, 0, 0, 97, 96)

               const FINAL = convertImage(_canvas.canvas.getContext("2d").getImageData(0, 0, 97, 96))
          })

My Code Locally (Windows 10 env Working) :

fs.readFile('./test.svg', 'utf8' , (err, image) => {

    if (err)
        throw new Error("Error openning frame")

    image = image.replace('<html>','')
    image = image.replace('</html>','')
    image = image.replace('<head>','')
    image = image.replace('</head>','')
    image = image.replace('<body>','')
    image = image.replace('</body>','')



    sharp(Buffer.from(image,'utf-8')).toFormat("png").toBuffer(async (err, data, info) => {
                              
        //data is output file buffer

    const image = await resolveImage(data);

    let canvas = new Canvas(97, 96).printImage(image, 0, 0, 97, 96)

    

    fs.writeFile('./new.svg', Ass.convertImage(canvas.canvas.getContext("2d").getImageData(0, 0, 97, 96)), err => {
        if (err) {
          console.error(err)
          return
        }
    })

  })
})



Source: https://stackoverflow.com/questions/70600457/skia-canvas-err-dlopen-failed

Change the lottie animation based on the react state

A game program written in the Python language