serverless / serverless/serverless

Lambda deployment failing due to roleRole too long after updating to serverless 1.42.0

Open
#6,198 7 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug cat/aws-iam
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 the roleName is built using the template {service}-{stage}-{lambdaName}-{region}-lambdaRole. On version 1.41.1, if this name is longer than 64 characters the roleName is 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 some roleNames 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 suffix lambdaRole should 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 from iamRoleStatements that are specified per lambda.
    The service has 12 characters. The stage has 9 characters. The lambdaName has 21 characters. And the region is us-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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.