Closed msimperi closed 1 year ago
+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!
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.
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: Bug Report