It really sounds like this:
- Your new dependency was not packaged in your deployable
.zip or - Your new zip code did not load / deploy correctly.
I don't think there is any reason for this particular package to have a problem in the Lambda environment. I followed the tutorial related , deployed and tested the lambda, added the nightmare-download-manager dependency, repackaged and redistributed. and everything works as expected.
Verify Deployment
After checking the dependency exists in your workspace and in your deployable zip file, if you still have problems, you need to check the dependency in a lambda environment.
I have not seen a way to verify the existence and contents of node_modules in the AWS console, but you can do this using the CLI :
aws lambda get-function --function-name <function-name>
There is a link in the answer (useful for 10 minutes) that will allow you to download the zip file from which the code was derived. Download this zip and make sure that inside it is node_modules/nightmare-download-manager containing the expected files.
If it is missing, something went wrong with your packaging or with the download / deployment of your package. Repackaging (zip up lib , node_modules and index.js ) and index.js using the AWS console.
Assuming it is, the require statements in the question work fine for me on both Node 4.3 and Node 6.10.
source share