Skip to content

Commit e48af04

Browse files
authored
feat(synthetics): CloudWatch Synthetics NodeJS Pupeteer 6.0 Runtime with NodeJS 18 (#27339)
Added `syn-nodejs-puppeteer-6.0` version to avaiable synthetic runtimes. This version runs on Node 18 allowing users to move away from node 16 (which is now at EOL). Changed an exisiting test to refrence the latest runtime and also updated the examples in the readme to refrence the latest runtime. Closes #27337. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent d80c4ee commit e48af04

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

packages/aws-cdk-lib/aws-synthetics/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const canary = new synthetics.Canary(this, 'MyCanary', {
2020
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
2121
handler: 'index.handler',
2222
}),
23-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
23+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
2424
environmentVariables: {
2525
stage: 'prod',
2626
},
@@ -110,7 +110,7 @@ const canary = new synthetics.Canary(this, 'Canary', {
110110
code: synthetics.Code.fromInline('/* Synthetics handler code'),
111111
}),
112112
cleanup: synthetics.Cleanup.LAMBDA,
113-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
113+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
114114
});
115115
```
116116

@@ -136,7 +136,7 @@ new synthetics.Canary(this, 'Inline Canary', {
136136
code: synthetics.Code.fromInline('/* Synthetics handler code */'),
137137
handler: 'index.handler', // must be 'index.handler'
138138
}),
139-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
139+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
140140
});
141141

142142
// To supply the code from your local filesystem:
@@ -145,7 +145,7 @@ new synthetics.Canary(this, 'Asset Canary', {
145145
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
146146
handler: 'index.handler', // must end with '.handler'
147147
}),
148-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
148+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
149149
});
150150

151151
// To supply the code from a S3 bucket:
@@ -156,7 +156,7 @@ new synthetics.Canary(this, 'Bucket Canary', {
156156
code: synthetics.Code.fromBucket(bucket, 'canary.zip'),
157157
handler: 'index.handler', // must end with '.handler'
158158
}),
159-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
159+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
160160
});
161161
```
162162

@@ -195,7 +195,7 @@ new synthetics.Canary(this, 'Vpc Canary', {
195195
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
196196
handler: 'index.handler',
197197
}),
198-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
198+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
199199
vpc,
200200
});
201201
```
@@ -242,7 +242,7 @@ const canary = new synthetics.Canary(this, 'MyCanary', {
242242
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
243243
handler: 'index.handler',
244244
}),
245-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
245+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
246246
artifactsBucketLifecycleRules: [{
247247
expiration: Duration.days(30),
248248
}],

packages/aws-cdk-lib/aws-synthetics/lib/runtime.ts

+15
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,21 @@ export class Runtime {
122122
*/
123123
public static readonly SYNTHETICS_NODEJS_PUPPETEER_5_1 = new Runtime('syn-nodejs-puppeteer-5.1', RuntimeFamily.NODEJS);
124124

125+
/**
126+
* `syn-nodejs-puppeteer-6.0` includes the following:
127+
* - Lambda runtime Node.js 18.x
128+
* - Puppeteer-core version 19.7.0
129+
* - Chromium version 111.0.5563.146
130+
*
131+
* New Features:
132+
* - **Dependency upgrade**: The Node.js dependency is upgraded to 18.x.
133+
* Bug fixes:
134+
* - **Bug fix**: Clean up core dump generated when Chromium crashes during a canary run.
135+
*
136+
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-6.0
137+
*/
138+
public static readonly SYNTHETICS_NODEJS_PUPPETEER_6_0 = new Runtime('syn-nodejs-puppeteer-6.0', RuntimeFamily.NODEJS);
139+
125140
/**
126141
* `syn-python-selenium-1.0` includes the following:
127142
* - Lambda runtime Python 3.8

packages/aws-cdk-lib/aws-synthetics/test/canary.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ describe('handler validation', () => {
749749
handler: 'invalidHandler',
750750
code: synthetics.Code.fromAsset(path.join(__dirname, 'canaries')),
751751
}),
752-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9,
752+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
753753
});
754754
}).toThrow(/Canary Handler must be specified either as 'fileName.handler', 'fileName.functionName', or 'folder\/fileName.functionName'/);
755755

@@ -759,7 +759,7 @@ describe('handler validation', () => {
759759
handler: 'canary.functionName',
760760
code: synthetics.Code.fromAsset(path.join(__dirname, 'canaries')),
761761
}),
762-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9,
762+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
763763
});
764764
}).not.toThrow();
765765

@@ -769,7 +769,7 @@ describe('handler validation', () => {
769769
handler: 'folder/canary.functionName',
770770
code: synthetics.Code.fromAsset(path.join(__dirname, 'canaries')),
771771
}),
772-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9,
772+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
773773
});
774774
}).not.toThrow();
775775
});

0 commit comments

Comments
 (0)