serverless / serverless/serverless
Lambda deployment failing due to roleRole too long after updating to serverless 1.42.0
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46.9k
- Forks
- 5.7k
- Avg merge
- 10h 7m
- Merged PRs (30d)
- 57
Description
This is a Bug Report
Description
Recently I updated from serverless version 1.38.x to the latest version (1.44.1) and the deployment of some of my lambdas stopped working due to the name of the roleName length been greater than 64. After some investigation I was able to conclude that the error started happening on version 1.42.0.
-
What went wrong?
The name of theroleNameis built using the template{service}-{stage}-{lambdaName}-{region}-lambdaRole. On version 1.41.1, if this name is longer than 64 characters theroleNameis been generated without the last part (i.e.-lambdaRole), which is an interesting behavior since this suffix is 11 characters long.
On version 1.42.0 the behavior changed and the suffix is always been added. This made someroleNames that previously had 54 characters jump to 65 characters and now I am not able to deploy my stack anymore unless I rename some of my lambdas or my project. -
What did you expect should have happened?
Either the old behavior of selectively removing the suffixlambdaRoleshould be maintained or there should be a way of specifying the lambda role name. -
What was the config you used?
The lambda role is been generated fromiamRoleStatementsthat are specified per lambda.
Theservicehas 12 characters. Thestagehas 9 characters. ThelambdaNamehas 21 characters. And theregionisus-east-1. -
What stacktrace or error message from your provider did you see?
An error occurred: "..."IamRoleLambdaExecution - 1 validation error detected: Value '"..."-lambdaRole' at 'roleName' failed to satisfy constraint: Member must have length less than or equal to 64 (Service: AmazonIdentityManagement; Status Code: 400; Error Code: ValidationError; Request ID: "...").
Similar or dependent issues:
Additional Data
- Serverless Framework Version you're using: 1.42.0
- Operating System: Windows 10 (win32)
- Stack Trace: NA
- Provider Error messages: Described above.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Lambda deployment with Serverless Framework 1.41.1 and 1.42.0, using the service, stage, lambda name, and region lengths described in the report. Inspect the generated IAM role name and compare the two versions. Done means deployments no longer exceed AWS's 64-character roleName limit, either by preserving the earlier behavior or supporting an explicitly specified role name.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, javascript
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100