You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/aws-cdk-lib/aws-synthetics/README.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -267,7 +267,7 @@ new synthetics.Canary(this, 'Bucket Canary', {
267
267
```
268
268
269
269
> **Note:** Synthetics have a specified folder structure for canaries.
270
-
> For Node with puppeteer scripts supplied via `code.fromAsset()` or `code.fromBucket()`, the canary resource requires the following folder structure:
270
+
> For Node with puppeteer scripts supplied via `code.fromAsset()` or `code.fromBucket()`, the canary resource requires the following folder structure for runtime versions lesser than `syn-nodejs-puppeteer-11.0`:
271
271
>
272
272
> ```plaintext
273
273
> canary/
@@ -276,6 +276,22 @@ new synthetics.Canary(this, 'Bucket Canary', {
276
276
> ├── <filename>.js
277
277
> ```
278
278
>
279
+
> For puppeteer based runtime versions greater than or equal to `syn-nodejs-puppeteer-11.0`, `nodjs/node_modules` is not necessary but supported.
280
+
>
281
+
> Both
282
+
> ```plaintext
283
+
> canary/
284
+
> ├── nodejs/
285
+
> ├── node_modules/
286
+
> ├── <filename>.js
287
+
> ```
288
+
> And
289
+
> ```plaintext
290
+
> canary/
291
+
> ├── <filename>.js
292
+
> ```
293
+
> are supported.
294
+
>
279
295
> For Node with playwright scripts supplied via `code.fromAsset()` or `code.fromBucket()`, the canary resource requires the following folder structure:
thrownewValidationError(`The canary resource requires that the handler is present at "nodejs/node_modules/${nodeFilename}" but not found at ${this.assetPath} (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary_Nodejs.html)`,scope);
153
+
// Requires asset directory to have the structure 'nodejs/node_modules' for puppeteer runtime < version 11.0.
thrownewValidationError(`The canary resource requires that the handler is present at "${nodeFilename}" or "nodejs/node_modules/${nodeFilename}" but not found at ${this.assetPath} (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary_Nodejs.html)`,scope);
161
+
}
162
+
}else{
163
+
// For versions < 11.0, require nodejs/node_modules structure
thrownewValidationError(`The canary resource requires that the handler is present at "nodejs/node_modules/${nodeFilename}" but not found at ${this.assetPath} (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary_Nodejs.html)`,scope);
166
+
}
167
+
}
156
168
}
157
169
// Requires the canary handler file to have the extension '.js', '.mjs', or '.cjs' for the playwright runtime.
.toThrow(`The canary resource requires that the handler is present at "nodejs/node_modules/incorrect.js" but not found at ${assetPath} (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary_Nodejs.html)`);
228
228
});
229
229
230
+
test('puppeteer runtime >= 11.0 allows JS files in root path',()=>{
.toThrow(`The canary resource requires that the handler is present at "nodejs/node_modules/canary.js" but not found at ${assetPath} (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary_Nodejs.html)`);
0 commit comments