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
feat(synthetics): add Python runtime and latest Nodejs runtime (#16069)
This PR addresses the fact that the current synthetics module was built to support nodejs runtimes only by opening support for python runtimes. Closes#15138 and #16177.
**Breaking Changes**
- `Runtime('customRuntimeHere')` becomes `Runtime('customRuntime', 'runtimeFamily')`
- `Code.fromAnything('path').bind(this, 'handler')` becomes `Code.fromAnything('path').bind(this, 'handler', 'runtimeFamily')`
**Whats in this PR?**
- Adds latest Nodejs runtime (`syn-nodejs-puppeteer-3.2`) and updates integ test to it.
- Adds generic python script to the folder `test/canaries/python` in order to run unit & integration tests on it.
- Adds new `RuntimeFamily` enum that is required by the `Runtime` object to differentiate between Python and Node.
- Verifies the correct folder structure for Python runtimes (`python/<filename>.py`).
- Updates readme.
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy file name to clipboardExpand all lines: packages/@aws-cdk/aws-synthetics/README.md
+10-1
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ new synthetics.Canary(this, 'Bucket Canary', {
130
130
});
131
131
```
132
132
133
-
> **Note:** For `code.fromAsset()`and`code.fromBucket()`, the canary resource requires the following folder structure:
133
+
> **Note:**Synthetics have a specified folder structure for canaries. For Node scripts supplied via `code.fromAsset()`or`code.fromBucket()`, the canary resource requires the following folder structure:
134
134
>
135
135
> ```plaintext
136
136
> canary/
@@ -139,6 +139,15 @@ new synthetics.Canary(this, 'Bucket Canary', {
139
139
> ├── <filename>.js
140
140
> ```
141
141
>
142
+
>
143
+
> For Python scripts supplied via `code.fromAsset()` or `code.fromBucket()`, the canary resource requires the following folder structure:
144
+
>
145
+
> ```plaintext
146
+
> canary/
147
+
> ├── python/
148
+
> ├── <filename>.py
149
+
> ```
150
+
>
142
151
> See Synthetics [docs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary.html).
thrownewError(`The canary resource requires that the handler is present at "nodejs/node_modules/${filename}" but not found at ${this.assetPath} (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary.html#CloudWatch_Synthetics_Canaries_write_from_scratch)`);
thrownewError(`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)`);
thrownewError(`The canary resource requires that the handler is present at "python/${pythonFilename}" but not found at ${this.assetPath} (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary_Python.html)`);
137
143
}
138
144
}
139
145
}
@@ -151,7 +157,7 @@ export class InlineCode extends Code {
0 commit comments