You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The resource AWS::Lambda::Function 'ApiApiGatewayToLambdaLambdaFunction036A2BFE' has specified S3 location for Code. It will not be built and SAM CLI does not support invoking it locally.
The resource AWS::Lambda::Function 'ApiApiGatewayToLambdaLambdaFunction036A2BFE' has specified S3 location for Code. It will not be built and SAM CLI does not support invoking it locally.
AwsCdkProjectDev/ApiApiGatewayToLambdaLambdaFunction036A2BFE not found. Possible options in your template: []
Error: Function AwsCdkProjectDev/ApiApiGatewayToLambdaLambdaFunction036A2BFE not found in template
Environment
CDK CLI Version : 1.106.1
CDK Framework Version: 1.106.1
AWS Solutions Constructs Version : 1.106.1
OS : macOS Catalina 10.15.7
Language : English
Other
The ApiGatewayToLambda construct overwrites the Metadata field (source code) to add the cfn_nag object. The original CDK Lambda construct populates fields like aws:asset:path and aws:asset:property into the resource Metadata. sam-beta-cdk relies on these info to locate the local Lambda code. I think the ApiGatewayToLambda construct should try to avoid overwriting the whole Metadata object. Instead, it should only update the existing Metadata object. Thanks @hawflau for the analysis!
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered:
@biffgaut thanks a lot! Saw that this was finally released in AWS Solutions Constructs 1.114.0 today, tested with the latest AWS SAM CLI beta and it works.
$ sam-beta-cdk local invoke UUID4GeneratorBackend-Dev/LambdaFunction | jq
Synthesizing CDK App
Invoking app.handler (python3.7)
Skip pulling image and use local one: amazon/aws-sam-cli-emulation-image-python3.7:rapid-1.22.0.dev202107140310.
Mounting /Users/apulver/aws-cdk-project-structure-python-basic/.aws-sam/.cdk-out/asset.95125f45dbdf585e631e3e345d6e11e03ba441f7d55587aaf2a22c66392ce5c7 as /var/task:ro,delegated inside runtime container
START RequestId: 12c2925f-9e79-4713-9046-9db3be3c5195 Version: $LATEST
request: {}
END RequestId: 12c2925f-9e79-4713-9046-9db3be3c5195
REPORT RequestId: 12c2925f-9e79-4713-9046-9db3be3c5195 Init Duration: 0.24 ms Duration: 960.08 ms Billed Duration: 1000 ms Memory Size: 128 MB Max Memory Used: 128 MB
{
"statusCode": 200,
"headers": {
"Content-Type": "text/plain"
},
"body": "Hello, CDK! Here is your UUID4: {'uuid': '32c5e81c-c9b7-48ef-91fb-ac8a9fddafab'}\n"
}
AWS SAM CLI beta CDK build cannot invoke Lambda function generated by
aws_solutions_constructs.aws_apigateway_lambda.ApiGatewayToLambda
construct.Reproduction Steps
Install AWS SAM CLI beta CDK build following the instructions in Getting started with AWS SAM and the AWS CDK
Run the following commands:
Error Log
Environment
Other
The
ApiGatewayToLambda
construct overwrites theMetadata
field (source code) to add thecfn_nag
object. The original CDK Lambda construct populates fields likeaws:asset:path
andaws:asset:property
into the resourceMetadata
.sam-beta-cdk
relies on these info to locate the local Lambda code. I think theApiGatewayToLambda
construct should try to avoid overwriting the whole Metadata object. Instead, it should only update the existingMetadata
object. Thanks @hawflau for the analysis!This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: