@go-to-k/cdkd 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -11216,6 +11216,7 @@ var LambdaFunctionProvider = class {
11216
11216
  `Pre-delete VPC detach failed for ${physicalId}: ${error instanceof Error ? error.message : String(error)} \u2014 continuing with delete`
11217
11217
  );
11218
11218
  }
11219
+ await this.waitForLambdaUpdateCompleted(physicalId);
11219
11220
  }
11220
11221
  try {
11221
11222
  await this.lambdaClient.send(new DeleteFunctionCommand({ FunctionName: physicalId }));
@@ -11323,6 +11324,56 @@ var LambdaFunctionProvider = class {
11323
11324
  * Timeout is a soft warning — downstream Subnet/SG deletion has its own
11324
11325
  * retries.
11325
11326
  */
11327
+ /**
11328
+ * Poll GetFunction until LastUpdateStatus is no longer `InProgress`.
11329
+ *
11330
+ * After UpdateFunctionConfiguration the Lambda service processes the
11331
+ * change (including VPC detach + hyperplane ENI release) asynchronously.
11332
+ * Returning early — i.e. calling DeleteFunction while the update is still
11333
+ * `InProgress` — aborts the detach, leaving ENIs attached and blocking
11334
+ * downstream Subnet / SG deletion.
11335
+ *
11336
+ * Bounded by eniWaitTimeoutMs (10min) and treated as a soft warning on
11337
+ * timeout: the subsequent ENI cleanup loop and downstream retries cover
11338
+ * the residual edge case.
11339
+ */
11340
+ async waitForLambdaUpdateCompleted(functionName) {
11341
+ const start = Date.now();
11342
+ let delay = this.eniWaitInitialDelayMs;
11343
+ for (; ; ) {
11344
+ let status;
11345
+ try {
11346
+ const resp = await this.lambdaClient.send(
11347
+ new GetFunctionCommand({ FunctionName: functionName })
11348
+ );
11349
+ status = resp.Configuration?.LastUpdateStatus;
11350
+ } catch (error) {
11351
+ if (error instanceof ResourceNotFoundException) {
11352
+ return;
11353
+ }
11354
+ this.logger.debug(
11355
+ `GetFunction failed while waiting for ${functionName} update: ${error instanceof Error ? error.message : String(error)}`
11356
+ );
11357
+ }
11358
+ if (status && status !== "InProgress") {
11359
+ this.logger.debug(
11360
+ `Lambda ${functionName} update completed (LastUpdateStatus=${status}) after ${Date.now() - start}ms`
11361
+ );
11362
+ return;
11363
+ }
11364
+ const elapsed = Date.now() - start;
11365
+ if (elapsed >= this.eniWaitTimeoutMs) {
11366
+ this.logger.warn(
11367
+ `Timeout (${this.eniWaitTimeoutMs}ms) waiting for Lambda ${functionName} update to complete; proceeding with delete`
11368
+ );
11369
+ return;
11370
+ }
11371
+ const remaining = this.eniWaitTimeoutMs - elapsed;
11372
+ const sleepMs = Math.min(delay, remaining);
11373
+ await this.sleep(sleepMs);
11374
+ delay = Math.min(delay * 2, this.eniWaitMaxDelayMs);
11375
+ }
11376
+ }
11326
11377
  async cleanupLambdaEnis(functionName) {
11327
11378
  const start = Date.now();
11328
11379
  let delay = this.eniWaitInitialDelayMs;
@@ -27605,7 +27656,7 @@ function reorderArgs(argv) {
27605
27656
  }
27606
27657
  async function main() {
27607
27658
  const program = new Command8();
27608
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.3.2");
27659
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.3.3");
27609
27660
  program.addCommand(createBootstrapCommand());
27610
27661
  program.addCommand(createSynthCommand());
27611
27662
  program.addCommand(createDeployCommand());