2

I'm deploying a lambda on AWS that uses the Sharp module to resize an image.

Despite using linux to deploy the following error happens:

"Something went wrong installing the sharp module,

Module parse failed: Unexpected character 'u007f' (1: 0),
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders,
(Source code omitted for this binary file), "

In my research I saw that the problem was associated with the OS. That it was necessary to install sharp using "npm install --arch = x64 --platform = linux sharp". However, the problem continues to happen.

Even using linux x84_64 this problem happens, does anyone know what it could be?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • 1
    Lambda JavaScript runtimes execute on an Amazon Linux 2 OS. You could investigate this issue further by launching an EC2 instance with that same OS and then working out what you need to do there to get Sharp working. Once you've done that, include the relevant package in your Lambda upload. – jarmod Aug 19 '20 at 00:24
  • Did you find the solution? – nacho Nov 11 '21 at 16:49
  • @nacho Yes, I did. I needed to use AWS Lambda Layer. I left the one referring to Sharp there.After a while I came across this tutorial that can be used: https://javascript.plainenglish.io/image-manipulation-with-sharp-aws-lambda-functions-layers-and-claudia-js-876d3dadcdb4 – Gustavo Souza Nov 12 '21 at 11:37

0 Answers0