Skip to content

(aws-lambda): Validate Lambda functionName #13264

@jonnekaunisto

Description

@jonnekaunisto

The lambda Function class should validate the functionName. Currently the only restriction is that the name is less than equal to 64 characters: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-functionname

Use Case

Catching bugs during build time instead of when deploying.

Proposed Solution

if (functionName.length > 64) { throw Error }

Other

This is the error that I got recently:

1 validation error detected: Value 'veryLongFunctionName' at 'functionName' failed to satisfy constraint: Member must have length less than or equal to 64 (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 5d3d811c-ff88-43db-b9e0-468197776ee0; Proxy: null)

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change (technically we will limit function names, but those would be rejected by CFN anyways)

This is a 🚀 Feature Request

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-lambdaRelated to AWS Lambdaeffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.feature/enhancementA new API to make things easier or more intuitive. A catch-all for general feature requests.good first issueRelated to contributions. See CONTRIBUTING.mdp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions