-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
Labels
@aws-cdk/aws-lambdaRelated to AWS LambdaRelated to AWS LambdabugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp2
Description
In v1.92.0, when fromDockerBuild is used, it is expected that contents /asset is copied, but instead the whole /asset is copied to output path, this makes Lambda handler reference index.handler failed, it has to be asset/index.handler.
Reproduction Steps
Create a index.js.
exports.handler = () => {
console.info("Test");
}A Dockerfile:
FROM amazon/aws-sam-cli-build-image-nodejs14.x
COPY index.js /asset/Use lambda.Code.fromDockerBuild:
export class ExampleStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
new lambda.Function(this, "ExampleFunction", {
runtime: lambda.Runtime.NODEJS_14_X,
handler: "index.handler",
code: lambda.Code.fromDockerBuild(ROOT_DIR),
});
}
}What did you expect to happen?
The Lamda code contains only index.js.
What actually happened?
The Lambda code contains asset/index.js.
Environment
- CDK CLI Version : 1.92.0
- Framework Version: 1.92.0
- Node.js Version: 14
- OS : macOS Catalina
- Language (Version): TypeScript 4.2.3
Other
This is caused by expected behavior of docker cp.
Suggestion: automatically append /. to imagePath if it doesn't.
This is 🐛 Bug Report
bigkraig
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-lambdaRelated to AWS LambdaRelated to AWS LambdabugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp2