@go-to-k/cdkd 0.4.0 → 0.5.0

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.
Binary file
package/dist/index.js CHANGED
@@ -7352,6 +7352,57 @@ var IMPLICIT_DELETE_DEPENDENCIES = {
7352
7352
  ]
7353
7353
  };
7354
7354
 
7355
+ // src/deployment/retryable-errors.ts
7356
+ var RETRYABLE_ERROR_MESSAGE_PATTERNS = [
7357
+ // IAM propagation
7358
+ "cannot be assumed",
7359
+ "role defined for the function",
7360
+ "not authorized to perform",
7361
+ "execution role",
7362
+ "trust policy",
7363
+ "Role validation failed",
7364
+ "does not have required permissions",
7365
+ "Trusted Entity",
7366
+ "currently in the following state: Pending",
7367
+ // DELETE dependency ordering (parallel deletion race conditions)
7368
+ "has dependencies and cannot be deleted",
7369
+ "can't be deleted since it has",
7370
+ "DependencyViolation",
7371
+ // AWS eventual consistency (dependency just created but not yet visible)
7372
+ // e.g., RDS DBCluster referencing a just-created DBSubnetGroup
7373
+ "does not exist",
7374
+ // AppSync schema is being created asynchronously
7375
+ "Schema is currently being altered",
7376
+ // IAM principal not yet propagated to S3 bucket policy
7377
+ "Invalid principal in policy",
7378
+ // S3 bucket creation/deletion still in progress
7379
+ "conflicting conditional operation",
7380
+ // Secrets Manager: ForceDeleteWithoutRecovery may take a moment to propagate
7381
+ "scheduled for deletion",
7382
+ // DynamoDB Streams / Kinesis: IAM role not yet propagated
7383
+ "Cannot access stream",
7384
+ "Please ensure the role can perform",
7385
+ // KMS: IAM role not yet propagated for CreateGrant
7386
+ "KMS key is invalid for CreateGrant",
7387
+ // CloudWatch Logs SubscriptionFilter: Kinesis stream eventual consistency
7388
+ // or SubscriptionFilter role propagation. CW Logs probes the destination
7389
+ // by delivering a test message; if the stream is freshly ACTIVE or the
7390
+ // assumed role hasn't propagated, the probe fails with "Invalid request".
7391
+ "Could not deliver test message"
7392
+ ];
7393
+ var RETRYABLE_HTTP_STATUS_CODES = /* @__PURE__ */ new Set([429, 503]);
7394
+ function isRetryableTransientError(error, message) {
7395
+ const metadata = error.$metadata;
7396
+ const statusCode = metadata?.httpStatusCode;
7397
+ if (statusCode !== void 0 && RETRYABLE_HTTP_STATUS_CODES.has(statusCode))
7398
+ return true;
7399
+ const cause = error.cause;
7400
+ const causeStatus = cause?.$metadata?.httpStatusCode;
7401
+ if (causeStatus !== void 0 && RETRYABLE_HTTP_STATUS_CODES.has(causeStatus))
7402
+ return true;
7403
+ return RETRYABLE_ERROR_MESSAGE_PATTERNS.some((p) => message.includes(p));
7404
+ }
7405
+
7355
7406
  // src/deployment/deploy-engine.ts
7356
7407
  var InterruptedError = class extends Error {
7357
7408
  constructor() {
@@ -8348,7 +8399,7 @@ var DeployEngine = class {
8348
8399
  } catch (error) {
8349
8400
  lastError = error;
8350
8401
  const message = error instanceof Error ? error.message : String(error);
8351
- const isRetryable = this.isRetryableError(error, message);
8402
+ const isRetryable = isRetryableTransientError(error, message);
8352
8403
  if (!isRetryable || attempt >= maxRetries) {
8353
8404
  throw error;
8354
8405
  }
@@ -8365,53 +8416,6 @@ var DeployEngine = class {
8365
8416
  }
8366
8417
  throw lastError;
8367
8418
  }
8368
- /**
8369
- * Determine if an error is retryable (transient).
8370
- * Checks HTTP status codes (429 throttle, 503 unavailable)
8371
- * and IAM propagation delay message patterns.
8372
- */
8373
- isRetryableError(error, message) {
8374
- const metadata = error.$metadata;
8375
- const statusCode = metadata?.httpStatusCode;
8376
- if (statusCode === 429 || statusCode === 503)
8377
- return true;
8378
- const cause = error.cause;
8379
- const causeStatus = cause?.$metadata?.httpStatusCode;
8380
- if (causeStatus === 429 || causeStatus === 503)
8381
- return true;
8382
- const retryablePatterns = [
8383
- "cannot be assumed",
8384
- "role defined for the function",
8385
- "not authorized to perform",
8386
- "execution role",
8387
- "trust policy",
8388
- "Role validation failed",
8389
- "does not have required permissions",
8390
- "Trusted Entity",
8391
- "currently in the following state: Pending",
8392
- // DELETE dependency ordering (parallel deletion race conditions)
8393
- "has dependencies and cannot be deleted",
8394
- "can't be deleted since it has",
8395
- "DependencyViolation",
8396
- // AWS eventual consistency (dependency just created but not yet visible)
8397
- // e.g., RDS DBCluster referencing a just-created DBSubnetGroup
8398
- "does not exist",
8399
- // AppSync schema is being created asynchronously
8400
- "Schema is currently being altered",
8401
- // IAM principal not yet propagated to S3 bucket policy
8402
- "Invalid principal in policy",
8403
- // S3 bucket creation/deletion still in progress
8404
- "conflicting conditional operation",
8405
- // Secrets Manager: ForceDeleteWithoutRecovery may take a moment to propagate
8406
- "scheduled for deletion",
8407
- // DynamoDB Streams / Kinesis: IAM role not yet propagated
8408
- "Cannot access stream",
8409
- "Please ensure the role can perform",
8410
- // KMS: IAM role not yet propagated for CreateGrant
8411
- "KMS key is invalid for CreateGrant"
8412
- ];
8413
- return retryablePatterns.some((p) => message.includes(p));
8414
- }
8415
8419
  /**
8416
8420
  * Resolve stack outputs from template and resource attributes
8417
8421
  *