agutoli / serverless-layers

Serverless.js plugin implementing AWS Lambda Layers, reducing lambda size, warm-up, and deployment time.
MIT License
229 stars 53 forks source link

Bug in version 2.8.5 #166

Open OmarKhattab opened 4 months ago

OmarKhattab commented 4 months ago

Zip always results in 0 MB Screen Shot 2024-03-28 at 12 57 16 AM

I went back to v2.5.4 and its working fine.

fl-wxiao commented 3 months ago

Since someone has already raised the issue, I won't repeat it again.

After some debugging, I found that the problem probably occurs here(L87):

https://github.com/agutoli/serverless-layers/blob/842eb7ce374af7a400e6cec2176bcc6f1882919c/src/package/Dependencies.js#L86-L101

In this flow, the copyProjectFile method will be called multiple times to copy multiple files. The layersPackageDir directory will be cleaned up after each entry, causingyarn --production to be unable to complete the installation correctly.

franciszabala commented 2 months ago

I compared the source code between 2.7.0 and 2.8.5. It looks like the code in Dependencies.js at line 24 is causing the issue. After removing it, the issue was gone.

Looks like same issue here: https://github.com/agutoli/serverless-layers/issues/168

Same fix too