Skip to content

(synthetics): Canary code building similar to aws-cdk-lib/aws-lambda-nodejs/NodejsFunction #22271

@kogitant

Description

@kogitant

Describe the feature

The developer experience of writing Cloudwatch Synthetics canary scripts would be much nicer if support was provided for "packaging" the script code in a similar manner to NodejsFunction available when implementing lambda functions using typescript or javascript.

Adopting the same mechanism for canary scripts would

  • allow writing the code in typescript or javascript,
  • define a package.json with developmentDependencies etc.

This would also allow developers to not know or care about the internals of Cloudwatch Synthetics runtime and the need for having the canary scripts under nodejs/node_modules directory.

Use Case

Needing to place canary javascript files under node_modules directory makes script development quite painful. The need to package them under nodejs/node_modules is a runtime detail that shouldn't affect how the source code is organized during development. One could of course use something like Gulp to implement the "packaging" and potential typescript compilation of canary scripts into a directory with the required nodejs/node_modules structure. But this seems like something that CDK could solve for all by applying the same mechanisms used in aws-cdk-lib/aws-lambda-nodejs/NodejsFunction

Proposed Solution

Copy-paste of aws-cdk-lib/aws-lambda-nodejs/NodejsFunction into something that accepts nodejs and typescript source in any directory structure the developer desires and deploys the javascript canary scripts in whatever directory structure the Cloudwatch Synthetics service requires.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.43.0

Environment details (OS name and version, etc.)

macOs Monterey

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-syntheticsRelated to Amazon CloudWatch Syntheticseffort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.p2wontfixWe have determined that we will not resolve the issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions