-
Notifications
You must be signed in to change notification settings - Fork 4.4k
(aws-lambda): docker image function fails with insightsVersion property #16642
Copy link
Copy link
Closed
Labels
@aws-cdk/aws-lambdaRelated to AWS LambdaRelated to AWS LambdabugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp1
Description
when using a DockerImageFunction and trying to enable cloudwatch lambda insights through the insightsVersion property, lambda service fails to create the function with error:
1:08:45 PM | CREATE_FAILED | AWS::Lambda::Function | lambda8B5974B5
Resource handler returned message: "Lambda layers are not supported for functions created with container images. (Service: Lambda, Status Code: 400, Request ID: 0526411c-a65a-485e-8582-fe2f2ec4ff90, Extended Request ID: null)" (RequestToken: 283267a3-b4
80-d004-54bc-f83f3c52fde7, HandlerErrorCode: InvalidRequest)
new Function (/home/code/node_modules/@aws-cdk/aws-lambda/lib/function.ts:373:35)
\_ new DockerImageFunction (/home/code/node_modules/@aws-cdk/aws-lambda/lib/image-function.ts:44:5)
Reproduction Steps
const appHandler = new DockerImageFunction(this, 'lambda', {
code: DockerImageCode.fromImageAsset(path.join(__dirname, '../../')),
insightsVersion: LambdaInsightsVersion.VERSION_1_0_98_0,
});
What did you expect to happen?
to skip adding a layer and just manage the execution role instead
What actually happened?
creation failed
Environment
- CDK CLI Version : 1.124.0 (build 65761fe)
- Framework Version:
- Node.js Version: 14
- OS : linux
- Language (Version): typescript
Other
my first idea to fix this would be to overwrite the configureLambdaInsights method in the DockerImageFunction Class and just add the manged policy there and skip the addLayers part.
This is 🐛 Bug Report
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-lambdaRelated to AWS LambdaRelated to AWS LambdabugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp1