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 and that your package is not too big to upload. #119

Open atishpatel opened 4 years ago

atishpatel commented 4 years ago

It took me a few hours to figure this out so wanted to make note of it here.

If you run into this error, it could be because of different reasons. So, go into the './node_modules/grunt-aws-lambda/utils/deploy_task.js' file and change warning line (line 265) to

grunt.fail.warn('Package upload failed, check you have lambda:UpdateFunctionCode permissions and that your package is not too big to upload. ' + JSON.stringify(err));

This will show you the actual error message. My error was that the function was set to node 8 instead of node 12.

Package upload failed, check you have lambda:UpdateFunctionCode permissions and that your package is not too big to upload. {"message":"The runtime parameter of nodejs8.10 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs12.x) while creating or updating functions.","code":"InvalidParameterValueException","time":"2020-09-03T20:26:54.592Z","requestId":"24c9460a-9762-46f0-b3ba-9377bda83dd7","statusCode":400,"retryable":false,"retryDelay":31.681033677395032}

It was a 1 min fix once i saw that instead of looking up permissions and file size.