(@aws-cdk/aws-lambda): layers property and addLayer() DockerLayerStack construct #27666
Labels
@aws-cdk/aws-lambda
Related to AWS Lambda
documentation
This is a problem with documentation.
effort/medium
Medium work item – several days of effort
feature-request
A feature should be added or improved.
p2
Hello team,
Main issue: Lambda functions packaged as container images do not support adding Lambda layers to the function configuration, but CDK docs lists
layers
property as one ofDockerLayerStack
's valid props and addLayer() is valid method.From this closed issue: #14143
although there is an error added to the synthesis step when creating container function with layers, I found the issue with addLayer() method when trying to add the layer to the container function, it was passed the synthesize step and failed at stack deployment:
❌ Deployment failed: Error: The stack named DockerLayerStack failed to deploy: UPDATE_ROLLBACK_COMPLETE: Resource handler returned message: "Please don't provide Handler or Runtime or Layer when the intended function PackageType is Image. (Service: Lambda, Status Code: 400)" HandlerErrorCode: InvalidRequest)
What did you expect to have
doc: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.DockerImageFunction.html#addwbrlayerslayers
If the
layers
property is not able to used to add layer to theDockerImageFunction
construct, as well as theaddLayer()
method as this is something Lambda not support, I'm expecting these 2 are not listed in CDK documentation.This creates a lot of confusion, please consider to revise this doc.
Originally posted by @annguyen36 in #14143 (comment)
The text was updated successfully, but these errors were encountered: