From faa3ebf14c59211eb1a2561a2cb4d984cd1aba81 Mon Sep 17 00:00:00 2001 From: Daniel Neilson Date: Tue, 8 Jun 2021 21:18:56 +0000 Subject: [PATCH] fix(core): increase timeout for AcmCertificateImporter --- .../lib/core/lib/imported-acm-certificate.ts | 2 +- .../nodejs/x509-certificate/acm-handlers.ts | 4 +++- yarn.lock | 24 +++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/packages/aws-rfdk/lib/core/lib/imported-acm-certificate.ts b/packages/aws-rfdk/lib/core/lib/imported-acm-certificate.ts index 541653b41..c8855e1e1 100644 --- a/packages/aws-rfdk/lib/core/lib/imported-acm-certificate.ts +++ b/packages/aws-rfdk/lib/core/lib/imported-acm-certificate.ts @@ -139,7 +139,7 @@ export class ImportedAcmCertificate extends Construct implements ICertificate { layers: [ openSslLayer ], retryAttempts: 0, runtime: Runtime.NODEJS_12_X, - timeout: Duration.seconds(30), + timeout: Duration.minutes(5), }); this.database.grantReadWriteData(lambda); diff --git a/packages/aws-rfdk/lib/lambdas/nodejs/x509-certificate/acm-handlers.ts b/packages/aws-rfdk/lib/lambdas/nodejs/x509-certificate/acm-handlers.ts index a61f26816..8d5078bf3 100644 --- a/packages/aws-rfdk/lib/lambdas/nodejs/x509-certificate/acm-handlers.ts +++ b/packages/aws-rfdk/lib/lambdas/nodejs/x509-certificate/acm-handlers.ts @@ -84,9 +84,10 @@ export class AcmCertificateImporter extends DynamoBackedCustomResource { const arn: string = resource.ARN; let inUseByResources = []; const backoffGenerator = new BackoffGenerator({ - base: 200, + base: 1000, jitterDivisor: 4, maxAttempts, + maxIntervalMs: 30000, }); do { @@ -97,6 +98,7 @@ export class AcmCertificateImporter extends DynamoBackedCustomResource { inUseByResources = cert!.InUseBy || []; if (inUseByResources.length) { + console.log(`Sleeping -- Resource ${arn} in use by ${inUseByResources.join(', ')}`); await backoffGenerator.backoff(); } else { break; diff --git a/yarn.lock b/yarn.lock index 7ab4bc3d1..25b4a7399 100644 --- a/yarn.lock +++ b/yarn.lock @@ -507,6 +507,13 @@ "@aws-cdk/region-info" "1.106.1" constructs "^3.3.69" +"@aws-cdk/aws-imagebuilder@1.106.1": + version "1.106.1" + resolved "https://registry.yarnpkg.com/@aws-cdk/aws-imagebuilder/-/aws-imagebuilder-1.106.1.tgz#9edfe273fef70d3492bcb531060dfb2e0f5791ab" + integrity sha512-CbLmphLfOtpKACiKEEXtXHU/aEB69mMUp5nOe+AbgEB8HbELfFrybHNdzXqF9YYauZJ3rLutDWDupOAX0oaQDw== + dependencies: + "@aws-cdk/core" "1.106.1" + "@aws-cdk/aws-kinesis@1.106.1": version "1.106.1" resolved "https://registry.yarnpkg.com/@aws-cdk/aws-kinesis/-/aws-kinesis-1.106.1.tgz#52989ea05c0477c1fdbfce0ca0f0c15b48a7d8dd" @@ -4029,6 +4036,11 @@ crc32-stream@^4.0.1: crc-32 "^1.2.0" readable-stream "^3.4.0" +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + cross-spawn@^4: version "4.0.2" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41" @@ -10498,6 +10510,18 @@ ts-node@^8.0.2: source-map-support "^0.5.17" yn "3.1.1" +ts-node@^9.1.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.1.1.tgz#51a9a450a3e959401bda5f004a72d54b936d376d" + integrity sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg== + dependencies: + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + source-map-support "^0.5.17" + yn "3.1.1" + tsame@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/tsame/-/tsame-2.0.1.tgz#70410ddbefcd29c61e2d68549b3347b0444d613f"