I created a lambda function through the aws-amplify CLI by following an AWS workshop (https://amplify-workshop.go-aws.com/70_generating_thumbnails/10_creating_a_photo_processor_lambda.html). Seems that there is a problem with conflicting versions of Node.js somewhere.
I believe that the sharp library is the problem, so I have tried to change the version to the latest to see if that would do anything, but it did not fix the issue.
CloudWatch error log:
module initialization error: Error
was compiled against a different Node.js version using
NODE_MODULE_VERSION 67. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at Object.Module._extensions..node (module.js:681:18)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/var/task/node_modules/sharp/lib/constructor.js:10:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
I believe there is a simple fix, but I am unsure where the source of the problem lies. Thank you.