-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
sharp is not working ( install ) in aws lambda ( serverless-webpack ) #2230
Comments
Yes, I did it.
I did run above command in npm scripts ( before sls deploy ) also, I did
And I checked my node_modules/sharp and version information. ( = linux ) But. lambda logged "darwin-64" not "linux-x64". Additionally,
This command works well in lambda without serverless-webpack. But, lambda with serverless-webpack is not working. |
Hi, the commands documented at https://sharp.pixelplumbing.com/install#aws-lambda for you to use e.g. in the rm -rf node_modules/sharp
npm install --arch=x64 --platform=linux sharp Please note this is not the same as |
Yes, I also did it.
But, above examples is not working. I think that serverless-webpack plugin-in with sharp is not working properly. Another issue repo said that using lambda layer. But, I don't want to use lambda layer.. sorry.. |
Please can you provide a complete, standalone example with all dependencies, code and config, perhaps as a separate repo, that would allow someone else to reproduce this. |
I'm getting this same issue. I pretty much followed this example and then added sharp via this AWS Example. I wonder if the build layer portion of this is what is screwing things up because it runs:
Which may be installing the wrong version of sharp. When you run It certainly doesn't seem like it saves enough info for the latter npm install to know which special version to use.
I tried to update the build layer to
And then run the deploy script. Deploy Script
Unfortunately, this results in a new error I've never seen before:
Here's the full output:
|
Thank you.
I did change script command that commented previous examples. But, didn't work. |
Thank you.. I wrote that post.. |
So no luck still Seo? Are you also using layers when you upload/deploy your app? I wonder if that's the issue? Or at least related to it. I'm surprised others haven't faced this same problem. |
I did change module ( sharp to jimp ) Jimp is working. ( zero native dependency ) But, Jimp slower than sharp.. Jimp : https://www.npmjs.com/package/jimp sharp and jimp performance : https://sharp.pixelplumbing.com/performance |
It seems I just got past this issue but updating my build layer to use:
After doing this it works. |
Please, can you provide your serverless.yml ? I don't want to use lambda layer. |
Same issue. It looks like serverless is rebuilding all packages ignoring my local node_modules while deploying. I also tried using docker to npm install sharp as linux, but no luck. |
I solved this problem using aws codebuild. Thank you. |
I fixed this issue by forcing the webpack to run the scripts
https://sharp.pixelplumbing.com/install#aws-lambda |
I run into the same problem this thread was describing, developing on Windows and deploying to lambda. Your answer helped me a lot as I was using a similar stack of plugins. So thanks a lot. One caveat is that I assume it overrode the Windows installation, but I’m not sure if it’s safe. Thanks! |
@ahmedmehanna Thanks for the solution. Its works like charm. |
For those using esbuild plugin
|
thanks! |
I want to resize my lambda zip size.
So I did install serverless-webpack plugins and bundle my lambda.
Before bundled by webpack, only transpile typescript to javascript and deploy using serverless and works well.
But, lambda bundled by serverless-webpack is not working.
[Error message]
darwin-x64' binaries cannot be used on the 'linux-x64' platform. Please remove the 'node_modules/sharp/vendor'
I don't know how to do.
I did check node_modules/sharp/vendor and saw linux-64 target.
but lambda is darwin-x64 logged.
I don't want to use lambda layer.
How to do?
I did
But, lambda is not working
upload and delete lambda work well and resized zip size!!
but get ( resize image ) lambda is not.
Please help me.
Thank you
The text was updated successfully, but these errors were encountered: