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): support runtime nodejs puppeteer 4.0 #25553

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions packages/@aws-cdk/aws-synthetics-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,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_3_9,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
environmentVariables: {
stage: 'prod',
},
Expand Down Expand Up @@ -120,7 +120,7 @@ const canary = new synthetics.Canary(stack, 'Canary', {
code: synthetics.Code.fromInline('/* Synthetics handler code'),
}),
enableAutoDeleteLambdas: true,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
});
```

Expand All @@ -146,7 +146,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_3_9,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
});

// To supply the code from your local filesystem:
Expand All @@ -155,7 +155,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_3_9,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
});

// To supply the code from a S3 bucket:
Expand All @@ -166,7 +166,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_3_9,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
});
```

Expand Down Expand Up @@ -205,7 +205,7 @@ new synthetics.Canary(this, 'Vpc Canary', {
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
handler: 'index.handler',
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
vpc,
});
```
Expand Down
13 changes: 13 additions & 0 deletions packages/@aws-cdk/aws-synthetics-alpha/lib/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,19 @@ export class Runtime {
*/
public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_9 = new Runtime('syn-nodejs-puppeteer-3.9', RuntimeFamily.NODEJS);

/**
* `syn-nodejs-puppeteer-4.0` includes the following:
* - Lambda runtime Node.js 16.x
* - Puppeteer-core version 5.5.0
* - Chromium version 92.0.4512
*
* New Features:
* - **Dependency upgrades**: The Node.js dependency is updated to 16.x.
*
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-4.0
*/
public static readonly SYNTHETICS_NODEJS_PUPPETEER_4_0 = new Runtime('syn-nodejs-puppeteer-4.0', RuntimeFamily.NODEJS);

/**
* `syn-python-selenium-1.0` includes the following:
* - Lambda runtime Python 3.8
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-synthetics-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"@aws-cdk/integ-runner": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@aws-cdk/integ-tests-alpha": "0.0.0",
"@types/jest": "^29.5.1",
"jest": "^29.5.0",
"aws-cdk-lib": "0.0.0",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blueprint was renewed in AWS Synthetics service console and failed run, so I replaced this script to latest script.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This example comes from the AWS Synthetics service console "API canary" blueprint

import os
import json
import http.client
import urllib.parse
Expand All @@ -23,7 +24,7 @@ def verify_request(method, url, post_data=None, headers={}):
else:
conn = http.client.HTTPConnection(parsed_url.hostname, parsed_url.port)

conn.request(method, url, str(post_data), headers)
conn.request(method, url, post_data, headers)
response = conn.getresponse()
logger.info("Status Code: %s " % response.status)
logger.info("Response Headers: %s" % json.dumps(response.headers.as_string()))
Expand All @@ -46,7 +47,7 @@ def verify_request(method, url, post_data=None, headers={}):

def main():

url = 'https://example.com/'
url = os.environ['URL']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this dummy url to actual URL that created in integ test stack.

method = 'GET'
postData = ""
headers = {}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "31.0.0",
"files": {
"36618132bd37b6b15f9987b57ad1fbf613f1ad937aec72381232b163ed9c44c4": {
"source": {
"path": "asset.36618132bd37b6b15f9987b57ad1fbf613f1ad937aec72381232b163ed9c44c4.bundle",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "36618132bd37b6b15f9987b57ad1fbf613f1ad937aec72381232b163ed9c44c4.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"0d889e0d833f8b9b09eff9583a832802952f1f7f181507ea7cec6916c2721470": {
"source": {
"path": "IntegCanaryTestDefaultTestDeployAssert3AD5A094.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "0d889e0d833f8b9b09eff9583a832802952f1f7f181507ea7cec6916c2721470.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Loading