-
Notifications
You must be signed in to change notification settings - Fork 4k
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] Validation of canary file existence done too early #11630
Comments
+1 |
So it looks like the issue is specifically that it's validating the path before staging and not considering the staged (and in this case bundled) assets at all. |
Pending my PR, for anyone else running into this issue be sure to check out https://github.com/mrgrain/cdk-esbuild#amazon-cloudwatch-synthetics-canary-monitoring! |
A re-roll of #19342. Thanks @RichiCoder1 for doing most of this work! This PR moves asset validation from _before_ staging the asset to _after_, and then validates on the staged asset instead. This allows for asset bundling because our prior validation was too eager. In addition, this construct can help with synthetic canaries + bundled code: https://github.com/mrgrain/cdk-esbuild#amazon-cloudwatch-synthetics-canary-monitoring. Fixes #11630 Co-authored-by: Richard Simpson richicoder1@outlook.com ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
…26291) A re-roll of aws#19342. Thanks @RichiCoder1 for doing most of this work! This PR moves asset validation from _before_ staging the asset to _after_, and then validates on the staged asset instead. This allows for asset bundling because our prior validation was too eager. In addition, this construct can help with synthetic canaries + bundled code: https://github.com/mrgrain/cdk-esbuild#amazon-cloudwatch-synthetics-canary-monitoring. Fixes aws#11630 Co-authored-by: Richard Simpson richicoder1@outlook.com ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
When creating Canary lambda asset resource, the bundling does not happen before the validation of "existence" of canary file is done. This blocks the usage of bundling options in many case.
Reproduction Steps
What did you expect to happen?
I expected that the bundling would happen before CDK validates if canary file has been found from correct location of zip-file generated.
Using bundling I can run optimisation, validations, include only needed files and re-structure my code asset before creating zip file.
What actually happened?
I get error message before bundling has been executed as following:
The canary resource requires that the handler is present at "nodejs/node_modules/canary.js" but not found at /Users/mypath/src/synthetics/ (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary.html#CloudWatch_Synthetics_Canaries_write_from_scratch) Subprocess exited with error 1
Environment
Other
The code that triggers error is here: https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-synthetics/lib/code.ts#L135
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: