Skip to content

aws-lambda: Runtime.ALL is broken #35348

@nicolello-dev

Description

@nicolello-dev

Describe the bug

Hi,

I'm creating a lambda layer via the typescript CDK:

this.layer = new LayerVersion(this, "FfmpegLayer", {
      layerVersionName: "...",
      compatibleRuntimes: Runtime.ALL,
      ...
    });

And I'm getting the following error:

TranscriptionStack failed: _ToolkitError: The stack named BETA-ACCOUNT-eu-south-1-TranscriptionStack failed to deploy: UPDATE_ROLLBACK_COMPLETE: Resource handler returned message: "2 validation errors detected: Value '[nodejs, nodejs4.3, nodejs6.10, nodejs8.10, nodejs10.x, nodejs12.x, nodejs14.x, nodejs16.x, nodejs18.x, nodejs20.x, nodejs18.x, nodejs22.x, python2.7, python3.6, python3.7, python3.8, python3.9, python3.10, python3.11, python3.12, python3.13, java8, java8.al2, java11, java17, java21, dotnet6, dotnet8, null, dotnetcore1.0, dotnetcore2.0, dotnetcore2.1, dotnetcore3.1, go1.x, ruby2.5, ruby2.7, ruby3.2, ruby3.3, provided, provided.al2, provided.al2023, null]' at 'compatibleRuntimes' failed to satisfy constraint: Member must have length less than or equal to 15; Value '[nodejs, nodejs4.3, nodejs6.10, nodejs8.10, nodejs10.x, nodejs12.x, nodejs14.x, nodejs16.x, nodejs18.x, nodejs20.x, nodejs18.x, nodejs22.x, python2.7, python3.6, python3.7, python3.8, python3.9, python3.10, python3.11, python3.12, python3.13, java8, java8.al2, java11, java17, java21, dotnet6, dotnet8, null, dotnetcore1.0, dotnetcore2.0, dotnetcore2.1, dotnetcore3.1, go1.x, ruby2.5, ruby2.7, ruby3.2, ruby3.3, provided, provided.al2, provided.al2023, null]' at 'compatibleRuntimes' failed to satisfy constraint: Member must satisfy enum value set: [nodejs20.x, provided.al2023, python3.12, python3.13, nodejs22.x, java17, nodejs16.x, dotnet8, python3.10, java11, python3.11, dotnet6, java21, nodejs18.x, provided.al2, ruby3.3, ruby3.4, java8.al2, ruby3.2, python3.8, python3.9] (Service: Lambda, Status Code: 400, Request ID: ae9e8863-af0e-47f4-abdb-2aa42337bcb6) (SDK Attempt Count: 1)" (RequestToken: 9b892079-5b3f-eca1-c856-7b7fe5ef7218, HandlerErrorCode: GeneralServiceException)

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

No response

Expected Behavior

The layer should deploy without problems

Current Behavior

The layer isn't deployed due to a validation error

Reproduction Steps

Create a Construct in which you create a layer:

export class MyBrokenLayer extends Construct {
  public readonly layer: LayerVersion;
  constructor(...) {
    super(...);
    this.layer = new LayerVersion(this, "MyLayerName", {
      compatibleRuntimes: Runtime.ALL,
      compatibleArchitectures: [Architecture.X86_64],
      code: Code.fromAsset(...)
    })
  }
}

Possible Solution

Set Runtime.ALL to be en empty list, and interpret the empty list as "all runtimes", alternatively, as removing compatibleRuntimes fixes it, deprecate Runtime.ALL or add a notice on its jsdoc

Additional Information/Context

No response

AWS CDK Library version (aws-cdk-lib)

2.185.0

AWS CDK CLI version

2.1006.0

Node.js Version

24.6.0

OS

Linux 6.14.0-28-generic

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-lambdaRelated to AWS LambdabugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions