TShrestha
TShrestha

Reputation: 1318

Error generating zip file error while uploading lambda functions with lambda deploy

I have lambda functions folder structure as

    ---root
         -functions
           ---node_nodules
           ---lib
           ---function1.js
           ---function2.js
         -function1.lambda
         -function2.lambda

There are lot of functions and lot of lambda handler.

The file size of the functions folder is about 140mb due to node modules alone 138 MB. Though I was able to deploy the lambda function with

  lambda deploy function1.lambda.

But suddenly following error started to appear.

  Error generating zip file
 /usr/local/lib/node_modules/aws-lambda/lib/main.js:82
                    throw err;
                    ^

 RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded
at Socket.onChildStdout (child_process.js:354:14)
at Socket.emit (events.js:198:13)
at Socket.EventEmitter.emit (domain.js:448:20)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:265:13)
at Socket.Readable.push (_stream_readable.js:224:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:94:17)

I tried searching for the fix, but i could not find any appropriate one. Can anyone help here ? Thanks in advance.

Upvotes: 0

Views: 175

Answers (1)

Ram Grandhi
Ram Grandhi

Reputation: 961

Let me suggest to take a small detour to get The Serverless Framework here installed and let it package & deploy your Lambda. For an example, refer here.

It is going to be way lot easier, as it manages packaging ZIPs, deploying to AWS including downloading latest NPM modules before packaging and cleaning up etc.

Upvotes: 1

Related Questions