-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Couldn't load sharp #35
Comments
Hello, thanks for sharing this. I had the same recently, and this is most likely a package versioning issue, that we should be able to fix. Until we do, the easiest way to overcome this issue is actually to build and deploy the solution from a linux-x64 platform, such an EC2 instance, or CloudShell. |
The installation of platform-specific Sharp dependencies for Linux x64 architecture is handled in the prebuild script (as defined in package.json: https://github.com/aws-samples/image-optimization/blob/main/package.json#L8). To ensure a smooth deployment to x64 Lambda functions, I need your confirmation on a couple of things:
Having these platform-specific dependencies in place will ensure successful deployment of your image optimization solution on x64 Lambda. If you could answer these questions, it would be very helpful in understanding the situation and determining if there's a potential bug! You can manually install sharp and said dependencies too:
|
I had the same issue as @tusharr and manually installing the sharp binaries like you mentioned have worked for me as a workaround. |
I had the same issue and your answer helped me get the solution to work. Thank you! |
Thank you @piotrekwitkowski after spending a whole day on trying to make this sample work you mentioning the exact packages needed really helped. For future folks running into (pasting so that the error is searchable) Just run build and then follow the steps mentioned by @piotrekwitkowski 's post. |
@navamgupta thanks, glad it helped! Could you tell me what OS and CPU architecture you're running? |
@piotrekwitkowski Sure, its an older macbook Big sur OS, intel core i7 x86-64 |
I am trying to run this example and running into issues.
Developer Environment - Mac M1
Deploying to AWS Lambda Node 20.x
When I try to fetch an optimized Image with a URL like
https:// YOURDISTRIBUTION.cloudfront.net/images/rio/1.jpeg?format=auto&width=300
, it returns an errorCloudwatch shows the following error:
Could not load the \"sharp\" module using the linux-x64 runtime\nPossible solutions:\n- Ensure optional dependencies can be installed:\n npm install --include=optional sharp\n yarn add sharp --ignore-engines\n- Ensure your package manager supports multi-platform installation:\n See https://sharp.pixelplumbing.com/install#cross-platform\n- Add platform-specific dependencies:\n npm install --os=linux --cpu=x64 sharp\n- Consult the installation documentation:\n See https://sharp.pixelplumbing.com/install
After many attempts to fix this, I can't get the example to run. Any help is appreciated
The text was updated successfully, but these errors were encountered: