Array buffer allocation failed

aws
lambda

#1

Hi!

Could you tell me something about that deployment error?

Serverless: Invoke aws:common:validate
Serverless: Invoke aws:deploy:deploy

Range Error --------------------------------------------

Array buffer allocation failed

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

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

RangeError: Array buffer allocation failed
at new Uint8Array (native)
at createBuffer (buffer.js:68:17)
at allocate (buffer.js:216:12)
at Function.Buffer.allocUnsafe (buffer.js:176:10)
at tryCreateBuffer (fs.js:468:21)
at Object.fs.readFileSync (fs.js:513:14)
at zipFilePaths.map (/home/ubuntu/.nvm/versions/node/v6.0.0/lib/node_modules/serverless/lib/plugins/aws/deploy/lib/checkForChanges.js:96:28)
at Array.map (native)
at AwsDeploy.checkIfDeploymentIsNecessary (/home/ubuntu/.nvm/versions/node/v6.0.0/lib/node_modules/serverless/lib/plugins/aws/deploy/lib/checkForChanges.js:94:42)

I tried to resize de memorySize at serverless.yml but didn´t work, I think maybe is caused by the zip file that is trying to upload to aws (130M).

Regards!
Roberto


#2

Did you every find anything about this issue? I am just running into this issue now and can’t find any documentation online about it.

Thanks!


#3

Hey, I also got that error. It was solved by re-install “nvm” and “npm”.
After install both of them, I have these versions:

[root@ip-xxx-xx-xx-xxx build-scripts]# npm --version
–> 5.7.1

[root@ip-xxx-xx-xx-xxx build-scripts]# nvm --version
–> 0.33.8

I hope this workaround also works in your site,


#4

For your info,
After pass the first error “Array buffer allocation failed”, now I am getting this one:

Serverless Error ---------------------------------------
An error occurred: TagComplianceSubscribeLambdaFunction - Unzipped size must be smaller than 262144000 bytes.
Stack Trace --------------------------------------------

And the root cause is because of Unzipped size (> 250 Mb).

We can confirm it, by checking the AWS lambda limits:
https://docs.aws.amazon.com/lambda/latest/dg/limits.html

Indeed, it looks like the “Array buffer allocation failed” is related to the Unzipped files size.