You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to deploy my app using sls deploy, but recently, I've started getting this error.
$ sls deploy --stage prod --debug
Initializing...
(node:41224) ExperimentalWarning: The fs.promises API is experimental
Action: "deploy" - Stage: "prod" - Org: "___" - App: "____" - Name: "______"
Error: Your code size must be less than 200MB. Try using Webpack, Parcel, or AWS Lambda layers to reduce your code size.
at run (C:\Users\Tomas\AppData\Roaming\nvm\v10.16.0\node_modules\serverless\node_modules\@serverless\platform-client\src\instance.js:295:13)
at process._tickCallback (internal/process/next_tick.js:68:7)
2s » Serverless » Your code size must be less than 200MB. Try using Webpack, Parcel, or AWS Lambda layers to reduce your code size.
Documentation: https://github.com/serverless/components
Support: https://app.serverless.com/support
Slack: https://www.serverless.com/slack/
My serverless.yml config is pretty simple:
app: ____
component: [email protected]
name: ______
inputs:
src:
src: ./ # this is the root of the app, ie. the folder containing node_modules
exclude: # exclude the src files - not super important though
- src
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.
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:
npm i && npm run build && rimraf node_modules && npm i --production && sls deploy
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
The text was updated successfully, but these errors were encountered:
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!
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
The text was updated successfully, but these errors were encountered: