Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks
kogitant opened this issue Sep 28, 2022 · 3 comments
Closed
2 tasks
Labels
@aws-cdk/aws-synthetics Related to Amazon CloudWatch Synthetics effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 wontfix We have determined that we will not resolve the issue.

Comments

@kogitant
Copy link

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

@kogitant kogitant added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Sep 28, 2022
@github-actions github-actions bot added the @aws-cdk/aws-synthetics Related to Amazon CloudWatch Synthetics label Sep 28, 2022
@peterwoodworth peterwoodworth added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Sep 29, 2022
@kaizencc
Copy link
Contributor

I feel like, if we had the chance to change things, L3 libraries like NodejsFunction would live separately from the core libraries. I encourage you to write a L3 NodejsCanary library and publish it to construct hub. That is the likely path forward for this feature request.

@kaizencc
Copy link
Contributor

Since #26291 is merged, that is the most that we are going to do in CDK-land to support bundling canary code. We will support bundled code if it is self-rolled. Any additional abstraction should be its own 3rd party construct.

Here's a good option: https://github.com/mrgrain/cdk-esbuild#amazon-cloudwatch-synthetics-canary-monitoring

@kaizencc kaizencc added the wontfix We have determined that we will not resolve the issue. label Jul 11, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-synthetics Related to Amazon CloudWatch Synthetics effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 wontfix We have determined that we will not resolve the issue.
Projects
None yet
Development

No branches or pull requests

3 participants