CI layer artifact double zipped – Lambda Cannot find module
I installed the 10.0 version of the chrome-aws-lambda as a layer this morning. I then tried to use your example usage code, slightly modified to generate a pdf, as a test. I got an error saying Error: Cannot find module 'chrome-aws-lambda' Here's a screenshot. Should this not just work? https://www.screencast.com/t/AlCJDpNG
It's probably my lack of experience with Lambda. I could use some advice in any case.
The layer wasn't working because the CI/CD process builds a zip within a zip. Extracting the inner zip file and using that as the Lambda layer seems to have worked. It would be good to make a note of this in your readme.
Thanks for your work!
Thanks @Daemach
This is especially relevant, as some tools like the Archive Utility builtin to macOS unpack the two layers of zip compression in one go. As the structure that gets unpacked looks correct, this is very hard to debug.
It is caused by this upstream issue of GitHub Actions https://github.com/actions/upload-artifact/issues/39
Nonetheless, until that's fixed I would vote to reopen this issue to make this easier to find for others. (Maybe renaming it to something like "CI layer artifact double zipped – Lambda Cannot find module")
Sidenote: To only unzip the first layer of compression under macOS, run unzip chrome_aws_lambda.zip in the Terminal.
I downloaded it from the CI/CD as well, uploaded it to AWS, and spent a day trying to fix the module not found. After reading this, solved my problem in 3 minutes. Thanks @Daemach