Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(synthetics): Update CloudWatch Synthetics NodeJS runtimes #12907

Merged
merged 8 commits into from
Feb 21, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-synthetics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const canary = new synthetics.Canary(this, 'MyCanary', {
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
handler: 'index.handler',
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_2,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_0,
naamancampbell marked this conversation as resolved.
Show resolved Hide resolved
});
```

Expand Down Expand Up @@ -107,7 +107,7 @@ const canary = new Canary(this, 'MyCanary', {
code: synthetics.Code.fromInline('/* Synthetics handler code */'),
handler: 'index.handler', // must be 'index.handler'
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_2,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_0,
});

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

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

Expand Down
10 changes: 10 additions & 0 deletions packages/@aws-cdk/aws-synthetics/lib/canary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ export class Runtime {
*/
public static readonly SYNTHETICS_NODEJS_2_2 = new Runtime('syn-nodejs-2.2');

/**
* `syn-nodejs-puppeteer-3.0` includes the following:
* - Lambda runtime Node.js 12.x
* - Puppeteer-core version 5.5.0
* - Chromium version 88.0.4298.0
*
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-3.0
*/
public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_0 = new Runtime('syn-nodejs-puppeteer-3.0');

/**
* @param name The name of the runtime version
*/
Expand Down
18 changes: 9 additions & 9 deletions packages/@aws-cdk/aws-synthetics/test/canary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test('Canary can have generated name', () => {
handler: 'index.handler',
code: synthetics.Code.fromInline('/* Synthetics handler code */'),
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_0,
naamancampbell marked this conversation as resolved.
Show resolved Hide resolved
});

// THEN
Expand Down Expand Up @@ -220,7 +220,7 @@ test('Schedule can be set to 1 minute', () => {
handler: 'index.handler',
code: synthetics.Code.fromInline('/* Synthetics handler code */'),
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_0,
});

// THEN
Expand All @@ -240,7 +240,7 @@ test('Schedule can be set with Expression', () => {
handler: 'index.handler',
code: synthetics.Code.fromInline('/* Synthetics handler code */'),
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_0,
});

// THEN
Expand All @@ -260,7 +260,7 @@ test('Schedule can be set to run once', () => {
handler: 'index.handler',
code: synthetics.Code.fromInline('/* Synthetics handler code */'),
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_0,
});

// THEN
Expand All @@ -280,7 +280,7 @@ test('Throws when rate above 60 minutes', () => {
handler: 'index.handler',
code: synthetics.Code.fromInline('/* Synthetics handler code */'),
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_0,
}))
.toThrowError('Schedule duration must be between 1 and 60 minutes');
});
Expand All @@ -296,7 +296,7 @@ test('Throws when rate above is not a whole number of minutes', () => {
handler: 'index.handler',
code: synthetics.Code.fromInline('/* Synthetics handler code */'),
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_0,
}))
.toThrowError('\'59 seconds\' cannot be converted into a whole number of minutes.');
});
Expand All @@ -312,7 +312,7 @@ test('Can share artifacts bucket between canaries', () => {
handler: 'index.handler',
code: synthetics.Code.fromInline('/* Synthetics handler code */'),
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_0,
});

const canary2 = new synthetics.Canary(stack, 'Canary2', {
Expand All @@ -322,7 +322,7 @@ test('Can share artifacts bucket between canaries', () => {
code: synthetics.Code.fromInline('/* Synthetics handler code */'),
}),
artifactsBucketLocation: { bucket: canary1.artifactsBucket },
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_0,
});

// THEN
Expand All @@ -342,7 +342,7 @@ test('can specify custom test', () => {
console.log(\'hello world\');
};`),
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_0,
});

// THEN
Expand Down