Open tmilar opened 3 years ago
I'm running into the same issue, except my node_modules
folder is actually large at about 2.3GB due to ffmpeg use, and other media editing packages. I would love a feature that splits node_modules into layers automatically and adds them to the lambda function. I can't seem to figure this out even with more custom deployments, I have yet to find an article showing how to split the node_modules
folder into multiple lambda layers. If anyone has insight on this please refer me!
Another idea, if this can be deployed inside a docker container that would solve the memory issues.
Doesn't excludeDevDependencies: false
still work with the latest serverless cli? I'd make a guess it might be only supported by non-component based services.
One possible solution to this might be installing dev dependencies globally or outside the lambda folder somewhere above the file tree in the same project folder
I'm trying to deploy my app using
sls deploy
, but recently, I've started getting this error.My serverless.yml config is pretty simple:
Serverless Framework version:
Node version:
The weird part is that a week ago everything was working fine, and I didn't really have too much dependencies that would exceed the 200MB mark. For perspective, I've working in a different project with puppeteer which embeds a whole chrome instance that weighs about 60MB by itself.
This is my package.json:
Also, if I've tried building the app by preinstalling deps using
npm ci
but it still didn't work. The only workaround that did work was wiping out ALL my node_modules folder and then installing only production deps just like this:However it has the downside that it's a pretty CPU and disk (and time) resource-intensive step.
Also, I remember that the previous setup of Serverless Framework for example for AWS Lambda functions, was smart enough to only package the actually used dependencies, not all the node_modules folder, unless you opted out by specifying
excludeDevDependencies: false
So, what options do I have? Is this a bug that needs to be addressed on Serverless Framework side? Do I manually need to deplete and reinstall production-only dependencies every time? Or should I setup a webpack config just for this?
Thanks