Closed colehorvitz closed 6 months ago
can you please share the error in the Lambda log?
ah, seems like it's the same issue mentioned here https://github.com/aws-samples/image-optimization/issues/7#issuecomment-1683602984
"Error: Could not load the \"sharp\" module using the linux-x64 runtime"
But I am running npm run build
:/
I suspect that this is because the machine your running the build on is different from the Lambda's.
What is the machine characteristics you are running the build on?
Hey ! I also had some troubles making it work yesterday, I was installing sharp from MacOS ARM chip and couldn't make it work for x64 arch, so instead I used a lambda layer for sharp library and it worked out of the box. @achrafsouk It seems that the prebuild command is somehow deprecated for M1/M2 users
yeah better build it on an EC2 instance with similar CPU architecture as Lambda. I'll note it in the readme.
There is currently an open issue in npm that prevents you from installing platform-specific dependencies (like sharp for x64 arch on Mac with ARM chips): https://github.com/npm/cli/issues/4828 - please upvote the issue if you are experiencing similar problems.
Hello, I've encountered this error too… I'm a beginner regarding AWS and I don't know how I could do a build on an EC2 instance… Could someone point me in the right direction?
EDIT: This answer was helpful: https://github.com/aws-samples/image-optimization/issues/35#issuecomment-2026313394
Hello, I have deployed the solution as described by the tutorial. When I arrive at the part which says, " To verify that it is working properly, test the following optimized image URL https:// YOURDISTRIBUTION.cloudfront.net/images/rio/1.jpeg?format=auto&width=300", I go to the URL and receive a 502 server error (bad gateway). The screen says "internal server error". Any ideas?
The X-Amz-Cf-Id is 59DzRpe8853TUlsoAlUELQiFMzgGS1dPLRgsDw_9bQHQ_2JcGXdt6A==