Skip to content

Commit

Permalink
feat(synthetics): CloudWatch Synthetics NodeJS Pupeteer 6.0 Runtime w…
Browse files Browse the repository at this point in the history
…ith 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*
  • Loading branch information
Abdu03 authored Sep 29, 2023
1 parent d80c4ee commit e48af04
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
14 changes: 7 additions & 7 deletions packages/aws-cdk-lib/aws-synthetics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const canary = new synthetics.Canary(this, 'MyCanary', {
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
handler: 'index.handler',
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
environmentVariables: {
stage: 'prod',
},
Expand Down Expand Up @@ -110,7 +110,7 @@ const canary = new synthetics.Canary(this, 'Canary', {
code: synthetics.Code.fromInline('/* Synthetics handler code'),
}),
cleanup: synthetics.Cleanup.LAMBDA,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
});
```

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

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

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

Expand Down Expand Up @@ -195,7 +195,7 @@ new synthetics.Canary(this, 'Vpc Canary', {
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
handler: 'index.handler',
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
vpc,
});
```
Expand Down Expand Up @@ -242,7 +242,7 @@ const canary = new synthetics.Canary(this, 'MyCanary', {
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
handler: 'index.handler',
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
artifactsBucketLifecycleRules: [{
expiration: Duration.days(30),
}],
Expand Down
15 changes: 15 additions & 0 deletions packages/aws-cdk-lib/aws-synthetics/lib/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,21 @@ export class Runtime {
*/
public static readonly SYNTHETICS_NODEJS_PUPPETEER_5_1 = new Runtime('syn-nodejs-puppeteer-5.1', RuntimeFamily.NODEJS);

/**
* `syn-nodejs-puppeteer-6.0` includes the following:
* - Lambda runtime Node.js 18.x
* - Puppeteer-core version 19.7.0
* - Chromium version 111.0.5563.146
*
* New Features:
* - **Dependency upgrade**: The Node.js dependency is upgraded to 18.x.
* Bug fixes:
* - **Bug fix**: Clean up core dump generated when Chromium crashes during a canary run.
*
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-6.0
*/
public static readonly SYNTHETICS_NODEJS_PUPPETEER_6_0 = new Runtime('syn-nodejs-puppeteer-6.0', RuntimeFamily.NODEJS);

/**
* `syn-python-selenium-1.0` includes the following:
* - Lambda runtime Python 3.8
Expand Down
6 changes: 3 additions & 3 deletions packages/aws-cdk-lib/aws-synthetics/test/canary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ describe('handler validation', () => {
handler: 'invalidHandler',
code: synthetics.Code.fromAsset(path.join(__dirname, 'canaries')),
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
});
}).toThrow(/Canary Handler must be specified either as 'fileName.handler', 'fileName.functionName', or 'folder\/fileName.functionName'/);

Expand All @@ -759,7 +759,7 @@ describe('handler validation', () => {
handler: 'canary.functionName',
code: synthetics.Code.fromAsset(path.join(__dirname, 'canaries')),
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
});
}).not.toThrow();

Expand All @@ -769,7 +769,7 @@ describe('handler validation', () => {
handler: 'folder/canary.functionName',
code: synthetics.Code.fromAsset(path.join(__dirname, 'canaries')),
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_0,
});
}).not.toThrow();
});
Expand Down

0 comments on commit e48af04

Please sign in to comment.