Help: serverless deploy errors

I came across following errors as I try to deploy a hello world function. Any comments on this?

Thanks a lot!
Richard
serverless deploy
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Packaging service…
Serverless: Excluding development dependencies…

Range Error [ E R R_ F S_ F I L E_ T O O_ L A R G E] —

File size (2217996916) is greater than possible Buffer: 2147483647 bytes

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Stack Trace --------------------------------------------

RangeError [ERR_FS_FILE_TOO_LARGE]: File size (2217996916) is greater than possible Buffer: 2147483647 bytes
at FSReqWrap.readFileAfterStat [as oncomplete] (fs.js:264:11)
From previous event:
at Package.getFileContent (/usr/local/lib/nodejs/node-v10.15.3-linux-x64/lib/node_modules/serverless/lib/plugins/package/lib/zipService.js:130:15)
at Package.getFileContentAndStat (/usr/local/lib/nodejs/node-v10.15.3-linux-x64/lib/node_modules/serverless/lib/plugins/package/lib/zipService.js:119:12)
at Array.map ()
at WriteStream.output.on (/usr/local/lib/nodejs/node-v10.15.3-linux-x64/lib/node_modules/serverless/lib/plugins/package/lib/zipService.js:91:29)
at WriteStream.emit (events.js:189:13)
at WriteStream.EventEmitter.emit (domain.js:441:20)
at /usr/local/lib/nodejs/node-v10.15.3-linux-x64/lib/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:231:14
at /usr/local/lib/nodejs/node-v10.15.3-linux-x64/lib/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:258:16
at FSReqWrap.args [as oncomplete] (fs.js:140:20)

Your Environment Information -----------------------------
OS: linux
Node Version: 10.15.3
Serverless Version: 1.38.0

Solved. This was because I didn’t put the relevant files in a subdir, and from there to deploy.

Hi,

Could you please give some more info about the solution?

Hi,

It is quite simple that you should create a directory for the application you want to deploy and have all the relevant files under it. from there you run the command. The mistakes I had is that I tried to deploy from home directory which has too many files to cause the file size exceeds. Hope this helps.

Cheers,
Richard

Hi Richard,

Thanks for your answer. It seems the problem is different in my case. I get a “RangeError: Maximum call stack size exceeded” error message and tens of to “node_modules/graceful-fs/graceful-fs.js:218:29” file although I run the command in the correct directory.

Thanks again for you answer.

Hi,
you have an endless loop somewhere - if this happens on the deploy command, maybe check the .yml file(s) for any recent change you did that can affect how the node_modules are loading, maybe some module is loaded in a loop by mistake. like , two variables that reference eachother for example.