-
-
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
AWS Lambda Fails On Require #1885
Comments
If this problem started within the last 24 hours then please see #1882 and check any lockfiles for broken versions of |
I'm using vanilla npm, so my EDIT: The only thing I have installed besides sharp is lodash.get, which has no dependencies
|
Great, thanks for confirming. In the zip file you upload to Lambda, what are the contents of |
The contents of Here is a
|
When I unzipped the files, I did notice this error
Is it possible I am zipping in a way that is messing up symbolic links? |
Yes, broken symlinks sounds like a plausible reason for this error. Everything else you've pasted here looks OK. |
So I finally got to the bottom of it, and it turns out it was unrelated to your library. So I apologize for using up your time, and appreciate you helping me get to the bottom of it. I was using terraform to zip the Lambda contents, but the hashicorp/terraform-provider-archive#6 (comment) For anyone in the future who runs into this as a problem, I used the above to workaround terraform's inability to zip files with symlinks |
Glad to hear you got it working. If you're able, I'm sure users of terraform-provider-archive would welcome a PR to either fix this problem or a PR to clearly document this limitation in the currently-blank "Fill in for each provider" section of its README. |
Hi,
I apologize in advance if I'm missing something simple, but I've read through a bunch of the issues that were similar to this one, and the solutions did not fix my issue. I am using sharp in an AWS Lambda, which I am packing up on a Mac. Whenever the Lambda runs, I get this error when the Lambda attempts to require('sharp')
I have tried running the npm install with all the options mentioned in the installation guide, and using the docker run command. Both result in this same error message. I am able to use Sharp locally on my Mac with a docker run command of
docker run -v "$PWD":/var/task lambci/lambda:build-nodejs10.x node index2.js
where index2.js is just a little test file. I am on macOS 10.14.6 and using node10.x on the Lambda.Did you see the documentation relating to installation?
Yes, I have followed the instructions for setting up sharp for a Lambda function with the npm install and zip occuring on a Mac
Have you ensured the platform and version of Node.js used for
npm install
is the same as the platform and version of Node.js used at runtime?Yes, I tried both options available in the installation instructions
If you're (mis)using
sudo npm install
have you tried with thesudo npm install --unsafe-perm
flag?What is the complete output of running
npm install --verbose sharp
? Have you checked this output for useful error messages?I don't see any errors on the npm install
What is the output of running
npx envinfo --binaries --languages --system --utilities
?Would this be useful to run in the AWS Lambda?
The text was updated successfully, but these errors were encountered: