Description
What is the problem?
There is a new change in CDK Version 2.4.0 that makes the bundled assets to be created under the folder structure as following:
├── <asset root>
│ └── asset-input
│ ├── asset files
The issue is SAM expects to get the asset location in metadata property aws:asset:path
, so SAM can read the Lambda Function source code, so the customers can do local testing, but in the new Version, the value of the added metadata is the path till the Asset root directory (till the ), although it should be (/asset-input)
For an application that contains a PythonFunction, This is the directory structure after running cdk synth
using version 2.4.0
147dda696921:cdk_app melasmar$ cdk --version
2.4.0 (build 993f14d)
147dda696921:cdk_app melasmar$ cd cdk.out
147dda696921:cdk.out melasmar$ tree
.
├── CDKV2SupportDemoStack.assets.json
├── CDKV2SupportDemoStack.template.json
├── asset.993168cfa75b295eeea55bf603340284b9be46ebc079e4965f2c16f5470efda5
│ └── asset-input
│ ├── __init__.py
│ └── app.py
├── cdk.out
├── manifest.json
└── tree.json
and this is the synthesized template:
"MyFunction3BAA72D1": {
"Type": "AWS::Lambda::Function",
"Properties": {
............
},
"DependsOn": [
"MyFunctionServiceRole3C357FF2"
],
"Metadata": {
"aws:cdk:path": "CDKV2SupportDemoStack/MyFunction/Resource",
"aws:asset:path": "asset.993168cfa75b295eeea55bf603340284b9be46ebc079e4965f2c16f5470efda5",
"aws:asset:is-bundled": true,
"aws:asset:property": "Code"
}
and this is the output in case of using CDK version 2.3.0
147dda696921:cdk_app melasmar$ cdk --version
2.3.0 (build beaa5b2)
147dda696921:cdk_app melasmar$ cd cdk.out
147dda696921:cdk.out melasmar$ tree
.
├── CDKV2SupportDemoStack.assets.json
├── CDKV2SupportDemoStack.template.json
├── asset.8f47b59bc8d67146c1b3fdd46c077e64cf2e0021298beb44f424619eeaaad8d0
│ ├── __init__.py
│ └── app.py
├── cdk.out
├── manifest.json
└── tree.json
and this is the synthesized template:
"MyFunction3BAA72D1": {
"Type": "AWS::Lambda::Function",
"Properties": {
.........
},
"DependsOn": [
"MyFunctionServiceRole3C357FF2"
],
"Metadata": {
"aws:cdk:path": "CDKV2SupportDemoStack/MyFunction/Resource",
"aws:asset:path": "asset.8f47b59bc8d67146c1b3fdd46c077e64cf2e0021298beb44f424619eeaaad8d0",
"aws:asset:is-bundled": true,
"aws:asset:property": "Code"
}
},
Reproduction Steps
- create a simple CDK stack that contains a PythonFunction.
- run
cdk synth
- check the synthesized template, and the bundled assets directory
What did you expect to happen?
The value of the added aws:asset:path
metadata property should be the location of the source code of the bundled assets.
What actually happened?
The value of the added aws:asset:path
metadata property is the root asset directory.
CDK CLI Version
2.4.0
Framework Version
No response
Node.js Version
v14.15.4
OS
mac os
Language
Typescript
Language Version
No response
Other information
No response
Activity