Skip to content

Commit

Permalink
fix(custom-resources): incorrect sdkv3 fallback (#26693)
Browse files Browse the repository at this point in the history
Fixes logic within the aws-sdk-v3-handler for AwsCustomResource to
behave more like the v2 handler, in so much as if `installLatestSdk`
fails, but it can still require the package it was attempting to
install, it will continue.

This makes the runtime more friendly to deploying your constructs across
regions that may or may not have access to npm within the lambda
runtime.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
MrArnoldPalmer committed Aug 10, 2023
1 parent 42250f1 commit 0fc33d9
Show file tree
Hide file tree
Showing 168 changed files with 42,122 additions and 45,315 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"31.0.0"}
{"version":"33.0.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "31.0.0",
"version": "33.0.0",
"files": {
"c7bba0d9d477c86c6dc2adb0eb95842634a1c040dd3a66b42eec2bb604644d4f": {
"source": {
Expand All @@ -14,15 +14,15 @@
}
}
},
"eec545187c8ac2e517efd9fbf2f13eb327409c8aea5ab3f76dd09184a47a37f6": {
"d6fea47c1f0462158dff41f11b88b1cc5a13df20fda1d39aa230bae47a50ae63": {
"source": {
"path": "cors-twitch-test.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "eec545187c8ac2e517efd9fbf2f13eb327409c8aea5ab3f76dd09184a47a37f6.json",
"objectKey": "d6fea47c1f0462158dff41f11b88b1cc5a13df20fda1d39aa230bae47a50ae63.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
"corsapitestDeployment2BF1633Adc24ac182461aecc920a8724663ce2a1": {
"Type": "AWS::ApiGateway::Deployment",
"Properties": {
"Description": "Automatically created by the RestApi construct",
"RestApiId": {
"Ref": "corsapitest8682546E"
},
"Description": "Automatically created by the RestApi construct"
}
},
"DependsOn": [
"corsapitesttwitchDELETEB4C94228",
Expand All @@ -74,12 +74,12 @@
"corsapitestDeploymentStageprod8F31F2AB": {
"Type": "AWS::ApiGateway::Stage",
"Properties": {
"RestApiId": {
"Ref": "corsapitest8682546E"
},
"DeploymentId": {
"Ref": "corsapitestDeployment2BF1633Adc24ac182461aecc920a8724663ce2a1"
},
"RestApiId": {
"Ref": "corsapitest8682546E"
},
"StageName": "prod"
},
"DependsOn": [
Expand Down Expand Up @@ -182,14 +182,8 @@
"corsapitesttwitchGET4270341B": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"HttpMethod": "GET",
"ResourceId": {
"Ref": "corsapitesttwitch0E3D1559"
},
"RestApiId": {
"Ref": "corsapitest8682546E"
},
"AuthorizationType": "NONE",
"HttpMethod": "GET",
"Integration": {
"IntegrationHttpMethod": "POST",
"Type": "AWS_PROXY",
Expand All @@ -216,6 +210,12 @@
]
]
}
},
"ResourceId": {
"Ref": "corsapitesttwitch0E3D1559"
},
"RestApiId": {
"Ref": "corsapitest8682546E"
}
}
},
Expand Down Expand Up @@ -300,14 +300,8 @@
"corsapitesttwitchPOSTB52CFB02": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"HttpMethod": "POST",
"ResourceId": {
"Ref": "corsapitesttwitch0E3D1559"
},
"RestApiId": {
"Ref": "corsapitest8682546E"
},
"AuthorizationType": "NONE",
"HttpMethod": "POST",
"Integration": {
"IntegrationHttpMethod": "POST",
"Type": "AWS_PROXY",
Expand All @@ -334,6 +328,12 @@
]
]
}
},
"ResourceId": {
"Ref": "corsapitesttwitch0E3D1559"
},
"RestApiId": {
"Ref": "corsapitest8682546E"
}
}
},
Expand Down Expand Up @@ -418,14 +418,8 @@
"corsapitesttwitchDELETEB4C94228": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"HttpMethod": "DELETE",
"ResourceId": {
"Ref": "corsapitesttwitch0E3D1559"
},
"RestApiId": {
"Ref": "corsapitest8682546E"
},
"AuthorizationType": "NONE",
"HttpMethod": "DELETE",
"Integration": {
"IntegrationHttpMethod": "POST",
"Type": "AWS_PROXY",
Expand All @@ -452,21 +446,21 @@
]
]
}
},
"ResourceId": {
"Ref": "corsapitesttwitch0E3D1559"
},
"RestApiId": {
"Ref": "corsapitest8682546E"
}
}
},
"corsapitesttwitchOPTIONSE5EEB527": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"HttpMethod": "OPTIONS",
"ResourceId": {
"Ref": "corsapitesttwitch0E3D1559"
},
"RestApiId": {
"Ref": "corsapitest8682546E"
},
"ApiKeyRequired": false,
"AuthorizationType": "NONE",
"HttpMethod": "OPTIONS",
"Integration": {
"IntegrationResponses": [
{
Expand Down Expand Up @@ -497,7 +491,13 @@
},
"StatusCode": "204"
}
]
],
"ResourceId": {
"Ref": "corsapitesttwitch0E3D1559"
},
"RestApiId": {
"Ref": "corsapitest8682546E"
}
}
},
"handlerServiceRole187D5A5A": {
Expand Down Expand Up @@ -540,13 +540,13 @@
},
"S3Key": "c7bba0d9d477c86c6dc2adb0eb95842634a1c040dd3a66b42eec2bb604644d4f.zip"
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"handlerServiceRole187D5A5A",
"Arn"
]
},
"Handler": "index.handler",
"Runtime": "nodejs14.x"
},
"DependsOn": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "31.0.0",
"version": "33.0.0",
"files": {
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
"source": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "31.0.0",
"version": "33.0.0",
"testCases": {
"cors/DefaultTest": {
"stacks": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "31.0.0",
"version": "33.0.0",
"artifacts": {
"cors-twitch-test.assets": {
"type": "cdk:asset-manifest",
Expand All @@ -17,7 +17,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/eec545187c8ac2e517efd9fbf2f13eb327409c8aea5ab3f76dd09184a47a37f6.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d6fea47c1f0462158dff41f11b88b1cc5a13df20fda1d39aa230bae47a50ae63.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down Expand Up @@ -54,7 +54,7 @@
"/cors-twitch-test/cors-api-test/Deployment/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "corsapitestDeployment2BF1633Aec735238f184cf252b8c47cd8212eacb"
"data": "corsapitestDeployment2BF1633Adc24ac182461aecc920a8724663ce2a1"
}
],
"/cors-twitch-test/cors-api-test/DeploymentStage.prod/Resource": [
Expand Down Expand Up @@ -159,10 +159,10 @@
"data": "CheckBootstrapVersion"
}
],
"corsapitestDeployment2BF1633A51392cbce1ac2785bd0e53063423e203": [
"corsapitestDeployment2BF1633Aec735238f184cf252b8c47cd8212eacb": [
{
"type": "aws:cdk:logicalId",
"data": "corsapitestDeployment2BF1633A51392cbce1ac2785bd0e53063423e203",
"data": "corsapitestDeployment2BF1633Aec735238f184cf252b8c47cd8212eacb",
"trace": [
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
]
Expand Down
Loading

0 comments on commit 0fc33d9

Please sign in to comment.