Tim-B / grunt-aws-lambda

A grunt plugin to assist in developing functions for AWS Lambda.
MIT License
247 stars 100 forks source link

Package upload failed, check you have lambda:UpdateFunctionCode permissions #78

Closed r-tanner-f closed 8 years ago

r-tanner-f commented 8 years ago

Opening this issue just as a marker for anyone else who runs in to it...

I just ran grunt deploy and ended up getting the error:

Package upload failed, check you have lambda:UpdateFunctionCode permissions.

The actual err returned in the lambda.updateFunctionCode callback was toString failed, which happens when a buffer exceeds kMaxLength.

This is probably because the dist folder is not in your .npmignore file. The zip file has exceeded the max size of a buffer and the AWS SDK is choking on it.

Either add dist to .npmignore or clean out your dist folder.

If your package really does exceed the maximum buffer size (which sounds like it's around 2GB right now), then you'll likely need to upload to an S3 bucket first, as AWS.lambda.updateFunctionCode doesn't seem to support streams.