aws-cdk-lib: Add a reference to the unbundled Lambda handler's path from the resource metadata #27402
Open
1 of 2 tasks
Labels
aws-cdk-lib
Related to the aws-cdk-lib package
effort/small
Small work item – less than a day of effort
feature-request
A feature should be added or improved.
p2
Describe the feature
Currently when I synth a
NodejsFunction
, I get this metadata on the resulting resource the synthesised template:I see use cases for an additional metadata item that provides a reference back to the original unbundled source file:
Use Case
A user might have limited knowledge of the stack and want to locate the source code for
MyFunction123
. Currently they'll get pointed to the asset folder which contains minified code. With the suggested additional property there'll be a two way tracability.My personal usecase is slightly different. I maintain samp-cli which has a command for local debugging of Lambda funcitons. This is different from
sam local
and gets triggered from real cloud events via MQTT. The challenge is to map an incoming event with the Lambda handler on disk. I could make it invoke the code in the CDK generated asset folders, but I'd lose the fast reloads I get when I don't have tocdk synth
after each change.Here's an image illustrating this. It's the red dotted line that I want to solve
I've been looking at using sourcemaps for this, but there's no way to identify the lambda entry point in the list of source files it provides.
Proposed Solution
Add
"aws:asset:source-path": "../src/my-function.ts"
to the resource's metadataOther Information
No response
Acknowledgements
CDK version used
2.96.1
Environment details (OS name and version, etc.)
Ubuntu 20.04
The text was updated successfully, but these errors were encountered: